Skip to main content
Glama
all.test.js853 B
'use strict' const { test } = require('node:test') const Fastify = require('../..') test('fastify.all should add all the methods to the same url', async t => { const fastify = Fastify() const requirePayload = [ 'POST', 'PUT', 'PATCH' ] const supportedMethods = fastify.supportedMethods t.plan(supportedMethods.length) fastify.all('/', (req, reply) => { reply.send({ method: req.raw.method }) }) await Promise.all(supportedMethods.map(async method => injectRequest(method))) async function injectRequest (method) { const options = { url: '/', method } if (requirePayload.includes(method)) { options.payload = { hello: 'world' } } const res = await fastify.inject(options) const payload = JSON.parse(res.payload) t.assert.deepStrictEqual(payload, { method }) } })

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