(path, req, res)
| 636 | } |
| 637 | |
| 638 | function onBadUrl (path, req, res) { |
| 639 | if (options.frameworkErrors) { |
| 640 | const id = getGenReqId(routeEventContext.server, req) |
| 641 | const childLogger = createChildLogger(routeEventContext, options.logger, req, id) |
| 642 | |
| 643 | const request = new Request(id, null, req, null, childLogger, routeEventContext) |
| 644 | const reply = new Reply(res, request, childLogger) |
| 645 | |
| 646 | const resolvedDisableRequestLogging = typeof disableRequestLogging === 'function' ? disableRequestLogging(req) : disableRequestLogging |
| 647 | if (resolvedDisableRequestLogging === false) { |
| 648 | childLogger.info({ req: request }, 'incoming request') |
| 649 | } |
| 650 | |
| 651 | return options.frameworkErrors(new FST_ERR_BAD_URL(path), request, reply) |
| 652 | } |
| 653 | const body = JSON.stringify({ |
| 654 | error: 'Bad Request', |
| 655 | code: 'FST_ERR_BAD_URL', |
| 656 | message: `'${path}' is not a valid url component`, |
| 657 | statusCode: 400 |
| 658 | }) |
| 659 | res.writeHead(400, { |
| 660 | 'Content-Type': 'application/json', |
| 661 | 'Content-Length': Buffer.byteLength(body) |
| 662 | }) |
| 663 | res.end(body) |
| 664 | } |
| 665 | |
| 666 | function onMaxParamLength (path, req, res) { |
| 667 | if (options.frameworkErrors) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…