forked from OpenWF/SpaceNinjaServer
		
	improve: log request body of unimplemented requests (#454)
This commit is contained in:
		
							parent
							
								
									0b03bc01d4
								
							
						
					
					
						commit
						12f3e1e9d1
					
				@ -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