diff --git a/lib/middleware/request-logger.js b/lib/middleware/request-logger.js index 10ac27644a..4916f51d59 100644 --- a/lib/middleware/request-logger.js +++ b/lib/middleware/request-logger.js @@ -1,12 +1,14 @@ 'use strict'; +const url = require('url'); const logger = require('../logger')('HTTP'); module.exports = function(config) { return (req, res, next) => { next(); if (config.enableRequestLogger) { - logger.info(`${res.statusCode} ${req.method} ${req.baseUrl}`); + const { pathname } = url.parse(req.originalUrl); + logger.info(`${res.statusCode} ${req.method} ${pathname}`); } }; }; diff --git a/lib/middleware/response-time.js b/lib/middleware/response-time.js index 4b4ee140bd..724bb8b89a 100644 --- a/lib/middleware/response-time.js +++ b/lib/middleware/response-time.js @@ -1,12 +1,14 @@ 'use strict'; +const url = require('url'); const responseTime = require('response-time'); const { REQUEST_TIME } = require('../events'); module.exports = function(config) { return responseTime((req, res, time) => { + const { pathname } = url.parse(req.originalUrl); const timingInfo = { - path: req.baseUrl, + path: pathname, method: req.method, statusCode: res.statusCode, time,