@fastify/reply-from
Version:
forward your HTTP request to another server, for fastify
30 lines (23 loc) • 580 B
JavaScript
const { test } = require('tap')
const Fastify = require('fastify')
const undici = require('undici')
const From = require('..')
test('destroyAgent false', async (t) => {
const mockAgent = new undici.Agent()
mockAgent.destroy = () => {
t.fail()
}
const instance = Fastify()
t.teardown(instance.close.bind(instance))
instance.get('/', (_request, reply) => {
reply.from()
})
instance.register(From, {
base: 'http://localhost:4242',
undici: mockAgent,
destroyAgent: false
})
await instance.ready()
await instance.close()
})