improve: log request body of unimplemented requests #454
@ -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" });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user