(path, req, res)
| 664 | } |
| 665 | |
| 666 | function onMaxParamLength (path, req, res) { |
| 667 | if (options.frameworkErrors) { |
| 668 | const id = getGenReqId(routeEventContext.server, req) |
| 669 | const childLogger = createChildLogger(routeEventContext, options.logger, req, id) |
| 670 | |
| 671 | const request = new Request(id, null, req, null, childLogger, routeEventContext) |
| 672 | const reply = new Reply(res, request, childLogger) |
| 673 | |
| 674 | const resolvedDisableRequestLogging = typeof disableRequestLogging === 'function' ? disableRequestLogging(req) : disableRequestLogging |
| 675 | if (resolvedDisableRequestLogging === false) { |
| 676 | childLogger.info({ req: request }, 'incoming request') |
| 677 | } |
| 678 | |
| 679 | return options.frameworkErrors(new FST_ERR_MAX_PARAM_LENGTH(path), request, reply) |
| 680 | } |
| 681 | const body = JSON.stringify({ |
| 682 | error: 'Bad Request', |
| 683 | code: 'FST_ERR_MAX_PARAM_LENGTH', |
| 684 | message: `'${path}' is exceeding the max param length`, |
| 685 | statusCode: 414 |
| 686 | }) |
| 687 | res.writeHead(414, { |
| 688 | 'Content-Type': 'application/json', |
| 689 | 'Content-Length': Buffer.byteLength(body) |
| 690 | }) |
| 691 | res.end(body) |
| 692 | } |
| 693 | |
| 694 | function buildAsyncConstraintCallback (isAsync, req, res) { |
| 695 | if (isAsync === false) return undefined |
nothing calls this directly
no test coverage detected