From 3f2bcffd04c6d2bee63c78979631b4ba0567f695 Mon Sep 17 00:00:00 2001 From: wuxuefeng Date: Thu, 19 Jul 2018 17:19:24 +0800 Subject: [PATCH 1/2] QUERY_STRING change type --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index 5bfb3ff..b6452d8 100644 --- a/index.js +++ b/index.js @@ -249,10 +249,9 @@ Logger.prototype = { this.params['SERVER_PROTOCOL'] = String(req.protocol).toUpperCase(); this.params['REQUEST_METHOD'] = req.method || ''; this.params['SERVER_PORT'] = req.app.settings ? req.app.settings.port : ''; - this.params['QUERY_STRING'] = req.query; + this.params['QUERY_STRING'] = req._parsedUrl ? req._parsedUrl.query : '-'; this.params['REQUEST_URI'] = req.originalUrl; this.params['REQUEST_PATHNAME'] = req._parsedUrl ? req._parsedUrl.pathname : '-'; - this.params['REQUEST_QUERY'] = req._parsedUrl ? req._parsedUrl.query : '-'; this.params['HOSTNAME'] = req.hostname; this.params['HTTP_HOST'] = req.headers.host; this.params['HTTP_VERSION'] = req.httpVersionMajor + '.' + req.httpVersionMinor; From b265f13487bca38674dbd24b8044b6bc03aac450 Mon Sep 17 00:00:00 2001 From: wuxuefeng Date: Thu, 19 Jul 2018 17:45:30 +0800 Subject: [PATCH 2/2] fixed query empty --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b6452d8..f171e7e 100644 --- a/index.js +++ b/index.js @@ -249,7 +249,7 @@ Logger.prototype = { this.params['SERVER_PROTOCOL'] = String(req.protocol).toUpperCase(); this.params['REQUEST_METHOD'] = req.method || ''; this.params['SERVER_PORT'] = req.app.settings ? req.app.settings.port : ''; - this.params['QUERY_STRING'] = req._parsedUrl ? req._parsedUrl.query : '-'; + this.params['QUERY_STRING'] = req._parsedUrl ? (req._parsedUrl.query || '-') : '-'; this.params['REQUEST_URI'] = req.originalUrl; this.params['REQUEST_PATHNAME'] = req._parsedUrl ? req._parsedUrl.pathname : '-'; this.params['HOSTNAME'] = req.hostname;