pinojs / pino-http

🌲 high-speed HTTP logger for Node.js
MIT License
527 stars 117 forks source link

Message "request completed" when request not completed #308

Closed someden closed 8 months ago

someden commented 9 months ago

Demo on codesandbox

Request was aborted by express.text middleware because: Request body length does not match content-length header (I know it's more like hypothetical situation, but anyway)

But there is request completed message from pino-http because res.writableEnded is true. Maybe it is better to change condition for defaultSuccessfulRequestMessageProvider to something like this:

  return !req.readableAborted && res.writableEnded ? 'request completed' : 'request aborted'
someden commented 9 months ago

In case there will be something wrong with demo here is screenshot:

Screenshot 2023-11-19 at 20 43 47