Aktueller Stand

This commit is contained in:
2026-01-22 19:05:45 +01:00
parent 85dee61a4d
commit e280e4eadb
1967 changed files with 397327 additions and 74093 deletions

View File

@@ -1,7 +1,7 @@
'use strict'
const { test } = require('tap')
const fastify = require('../')
const { test } = require('node:test')
const Fastify = require('..')
const { request, setGlobalDispatcher, Agent } = require('undici')
setGlobalDispatcher(new Agent({
@@ -9,23 +9,30 @@ setGlobalDispatcher(new Agent({
keepAliveMaxTimeout: 10
}))
test('post empty body', async t => {
const app = fastify()
t.teardown(app.close.bind(app))
app.post('/bug', async (request, reply) => {
test('post empty body', { timeout: 3_000 }, async t => {
const fastify = Fastify({ forceCloseConnections: true })
const abortController = new AbortController()
const { signal } = abortController
t.after(() => {
fastify.close()
abortController.abort()
})
await app.listen({ port: 0 })
fastify.post('/bug', async () => {
// This function must be async and return nothing
})
const res = await request(`http://127.0.0.1:${app.server.address().port}/bug`, {
await fastify.listen({ port: 0 })
const res = await request(`http://localhost:${fastify.server.address().port}/bug`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ foo: 'bar' })
body: JSON.stringify({ foo: 'bar' }),
signal
})
t.equal(res.statusCode, 200)
t.equal(await res.body.text(), '')
t.assert.strictEqual(res.statusCode, 200)
t.assert.strictEqual(await res.body.text(), '')
})