MCPcopy
hub / github.com/fastify/fastify / injectRequest

Function injectRequest

test/internals/all.test.js:24–37  ·  view source on GitHub ↗
(method)

Source from the content-addressed store, hash-verified

22 await Promise.all(supportedMethods.map(async method => injectRequest(method)))
23
24 async function injectRequest (method) {
25 const options = {
26 url: '/',
27 method
28 }
29
30 if (requirePayload.includes(method)) {
31 options.payload = { hello: 'world' }
32 }
33
34 const res = await fastify.inject(options)
35 const payload = JSON.parse(res.payload)
36 t.assert.deepStrictEqual(payload, { method })
37 }
38})

Callers 1

all.test.jsFile · 0.85

Calls 1

injectMethod · 0.80

Tested by

no test coverage detected