MCPcopy
hub / github.com/fastify/fastify / validate

Function validate

test/schema-special-usage.test.js:1034–1053  ·  view source on GitHub ↗
({
    params,
    body,
    querystring,
    headers,
    response
  })

Source from the content-addressed store, hash-verified

1032 }
1033
1034 async function validate ({
1035 params,
1036 body,
1037 querystring,
1038 headers,
1039 response
1040 }) {
1041 try {
1042 const res = await fastify.inject({
1043 method: 'POST',
1044 url: `/${params}`,
1045 headers: { id: headers },
1046 query: { id: querystring },
1047 payload: { id: body }
1048 })
1049 t.assert.strictEqual(res.statusCode, response)
1050 } catch (error) {
1051 t.assert.fail('should not throw')
1052 }
1053 }
1054})
1055
1056test('Check mixed sync and async AJV validations', async (t) => {

Callers 1

Calls 1

injectMethod · 0.80

Tested by

no test coverage detected