mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
Fix pathname reporting in middlewares
This commit is contained in:
parent
1695a35555
commit
57df35f6a5
@ -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}`);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user