From d3bdb51b242f7576dcefb6dd5be5efc5b8e30d12 Mon Sep 17 00:00:00 2001 From: Paulo Guarnier De Mitri Date: Thu, 15 Mar 2018 14:02:51 -0300 Subject: [PATCH] Checking for `content-type` header before json log. Additional condition before parsing the content of incoming request. --- lib/log.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/log.js b/lib/log.js index f2c3791..bc80224 100644 --- a/lib/log.js +++ b/lib/log.js @@ -35,7 +35,7 @@ const logLine = (message, date) => { const logRequest = async ({ req, start, requestIndex, limit }) => { logLine(`> #${requestIndex} ${chalk.bold(req.method)} ${req.url}`, start) - if (req.headers['content-length'] > 0) { + if (req.headers['content-length'] > 0 && req.headers['content-type'] === 'application/json') { try { const parsedJson = await json(req, { limit }) jsome(parsedJson)