From 37fda043d450a9cff8f4a0973b98fd3ff1384939 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Fri, 14 Aug 2020 00:51:44 +0200 Subject: [PATCH] [http] use public node api for getting the response content-length --- libraries/metrics/http.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/metrics/http.js b/libraries/metrics/http.js index 34fde3c247..295efbcab3 100644 --- a/libraries/metrics/http.js +++ b/libraries/metrics/http.js @@ -39,7 +39,7 @@ module.exports.monitor = logger => (function(req, res, next) { requestUrl: reqUrl, requestSize, status: res.statusCode, - responseSize: (res._headers != null ? res._headers["content-length"] : undefined), + responseSize: res.getHeader("content-length"), userAgent: req.headers["user-agent"], remoteIp, referer: referrer, @@ -61,7 +61,7 @@ module.exports.monitor = logger => (function(req, res, next) { "content-length": req.headers["content-length"] }, res: { - "content-length": (res._headers != null ? res._headers["content-length"] : undefined), + "content-length": res.getHeader("content-length"), statusCode: res.statusCode }, "response-time": responseTimeMs