Added request id header (#9122)

no issue

- be able to track a request through different systems
- case insensitive
- manual test only
This commit is contained in:
Katharina Irrgang 2017-10-09 14:48:32 +02:00 committed by Sebastian Gierlinger
parent d77e000113
commit 8c54f3cca9

View File

@ -7,7 +7,7 @@ var uuid = require('uuid'),
*/
module.exports = function logRequest(req, res, next) {
var startTime = Date.now(),
requestId = uuid.v1();
requestId = req.get('X-Request-ID') || uuid.v1();
function logResponse() {
res.responseTime = (Date.now() - startTime) + 'ms';