Skip to main content
Glama
middleware.test.js828 B
'use strict' const { test } = require('node:test') const Fastify = require('..') const { FST_ERR_DEC_ALREADY_PRESENT } = require('../lib/errors') test('Should be able to override the default use API', t => { t.plan(1) const fastify = Fastify() fastify.decorate('use', () => true) t.assert.strictEqual(fastify.use(), true) }) test('Cannot decorate use twice', t => { t.plan(1) const fastify = Fastify() fastify.decorate('use', () => true) try { fastify.decorate('use', () => true) } catch (err) { t.assert.ok(err instanceof FST_ERR_DEC_ALREADY_PRESENT) } }) test('Encapsulation works', t => { const fastify = Fastify() fastify.register((instance, opts, done) => { instance.decorate('use', () => true) t.assert.strictEqual(instance.use(), true) done() }) fastify.ready() })

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