MCPcopy Create free account
hub / github.com/fastify/fastify / onMaxParamLength

Function onMaxParamLength

fastify.js:665–688  ·  view source on GitHub ↗
(path, req, res)

Source from the content-addressed store, hash-verified

663 }
664
665 function onMaxParamLength (path, req, res) {
666 if (options.frameworkErrors) {
667 const id = getGenReqId(routeEventContext.server, req)
668 const childLogger = createChildLogger(routeEventContext, options.logger, req, id)
669
670 const request = new Request(id, null, req, null, childLogger, routeEventContext)
671 const reply = new Reply(res, request, childLogger)
672
673 routeEventContext.server[kLogController].incomingRequest(request, reply)
674
675 return options.frameworkErrors(new FST_ERR_MAX_PARAM_LENGTH(path), request, reply)
676 }
677 const body = JSON.stringify({
678 error: 'Bad Request',
679 code: 'FST_ERR_MAX_PARAM_LENGTH',
680 message: `'${path}' is exceeding the max param length`,
681 statusCode: 414
682 })
683 res.writeHead(414, {
684 'Content-Type': 'application/json',
685 'Content-Length': Buffer.byteLength(body)
686 })
687 res.end(body)
688 }
689
690 function buildAsyncConstraintCallback (isAsync, req, res) {
691 if (isAsync === false) return undefined

Callers

nothing calls this directly

Calls 3

getGenReqIdFunction · 0.85
createChildLoggerFunction · 0.85
incomingRequestMethod · 0.45

Tested by

no test coverage detected