MCPcopy
hub / github.com/fastify/fastify / notFound

Function notFound

lib/reply.js:1040–1060  ·  view source on GitHub ↗
(reply)

Source from the content-addressed store, hash-verified

1038}
1039
1040function notFound (reply) {
1041 if (reply[kRouteContext][kFourOhFourContext] === null) {
1042 reply.log.warn('Trying to send a NotFound error inside a 404 handler. Sending basic 404 response.')
1043 reply.code(404).send('404 Not Found')
1044 return
1045 }
1046
1047 reply.request[kRouteContext] = reply[kRouteContext][kFourOhFourContext]
1048
1049 // preHandler hook
1050 if (reply[kRouteContext].preHandler !== null) {
1051 preHandlerHookRunner(
1052 reply[kRouteContext].preHandler,
1053 reply.request,
1054 reply,
1055 internals.preHandlerCallback
1056 )
1057 } else {
1058 internals.preHandlerCallback(null, reply.request, reply)
1059 }
1060}
1061
1062/**
1063 * This function runs when a payload that is not a string|buffer|stream or null

Callers 1

reply.jsFile · 0.85

Calls 3

warnMethod · 0.80
sendMethod · 0.80
codeMethod · 0.80

Tested by

no test coverage detected