improve: log request body of unimplemented requests (#454)

This commit is contained in:
Sainan 2024-07-03 12:34:44 +02:00 committed by GitHub
parent 0b03bc01d4
commit 12f3e1e9d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,9 @@ import { /*NextFunction,*/ Request, Response } from "express";
const unknownEndpointHandler = (request: Request, response: Response) => {
logger.error(`unknown endpoint ${request.method} ${request.path}`);
if (request.body) {
logger.debug(`data provided to ${request.path}: ${String(request.body)}`);
}
response.status(404).json({ error: "endpoint was not found" });
};