Skip to main content
Glama
post-empty-body.test.js969 B
'use strict' const { test } = require('node:test') const Fastify = require('..') const { request, setGlobalDispatcher, Agent } = require('undici') setGlobalDispatcher(new Agent({ keepAliveTimeout: 10, keepAliveMaxTimeout: 10 })) 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() }) fastify.post('/bug', async () => { // This function must be async and return nothing }) 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' }), signal }) t.assert.strictEqual(res.statusCode, 200) t.assert.strictEqual(await res.body.text(), '') })

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/krtw00/search-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server