Blame view
lib/middlewares/common.js
652 Bytes
6623d664c
|
1 |
const uuidv1 = require('uuid/v1'); |
ab5828535
|
2 3 4 5 6 7 8 |
const logger = require('komodo-sdk/logger'); module.exports = function common(req, res, next) { if (req.url.search('/favicon.ico') === 0) { res.sendStatus(404); return; } |
6623d664c
|
9 |
res.locals.xid = uuidv1(); |
c98ae8750
|
10 |
res.locals.x_http_request_ts = new Date(); |
f2c18879a
|
11 |
logger.info(`Got request from ${res.locals.httpgetx_subsystem === 'CORE-CALLBACK' ? 'CORE' : 'PARTNER'}`, { |
ab5828535
|
12 |
xid: res.locals.xid, |
cfdcd1733
|
13 |
pid: process.pid, |
f2c18879a
|
14 |
requester_ip: req.ip, |
ab5828535
|
15 16 17 18 |
method: req.method, path: req.path, url: req.url, qs: req.query, |
f2c18879a
|
19 |
body: req.body, |
ab5828535
|
20 21 22 |
}); next(); }; |