Compare View
Commits (2)
Changes
Showing 4 changed files Side-by-side Diff
CHANGELOG.md
... | ... | @@ -4,8 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d |
4 | 4 | |
5 | 5 | Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). |
6 | 6 | |
7 | +#### [v0.14.12](https://gitlab.kodesumber.com/komodo/komodo-center-messaging/compare/v0.14.11...v0.14.12) | |
8 | + | |
9 | +- Log all request [`fded55b`](https://gitlab.kodesumber.com/komodo/komodo-center-messaging/commit/fded55b393e7ae91abd80b782d697396316219a5) | |
10 | + | |
7 | 11 | #### [v0.14.11](https://gitlab.kodesumber.com/komodo/komodo-center-messaging/compare/v0.14.10...v0.14.11) |
8 | 12 | |
13 | +> 4 October 2021 | |
14 | + | |
9 | 15 | - Fix config.do_not_reply_warning_on_empty_message [`4710178`](https://gitlab.kodesumber.com/komodo/komodo-center-messaging/commit/4710178b531f796b6a2ecbdd2b36ab68dfd506eb) |
10 | 16 | |
11 | 17 | #### [v0.14.10](https://gitlab.kodesumber.com/komodo/komodo-center-messaging/compare/v0.14.9...v0.14.10) |
lib/http-listener.js
... | ... | @@ -35,7 +35,7 @@ const port = (config && config.listener && config.listener.http |
35 | 35 | function mainHandler(req, res) { |
36 | 36 | if (!req.body) req.body = {}; |
37 | 37 | |
38 | - const xid = uniqid(); | |
38 | + const { xid } = res.locals; | |
39 | 39 | |
40 | 40 | logger.verbose(`${MODULE_NAME} 72AFD326: Got a request`, { |
41 | 41 | xid, |
... | ... | @@ -152,8 +152,28 @@ if (config.ip_whitelist && config.ip_whitelist.length) { |
152 | 152 | app.use(ipfilter(config.ip_whitelist, { mode: 'allow', log: false })); |
153 | 153 | } |
154 | 154 | |
155 | +app.use((req, res, next) => { | |
156 | + const xid = uniqid(); | |
157 | + res.locals.xid = xid; | |
158 | + | |
159 | + logger.verbose(`${MODULE_NAME} 83DF8231: Got a request`, { | |
160 | + xid, | |
161 | + ip: req.ip, | |
162 | + method: req.method, | |
163 | + requestContentType: req.get('content-type'), | |
164 | + url: req.url, | |
165 | + }); | |
166 | + | |
167 | + next(); | |
168 | +}); | |
169 | + | |
155 | 170 | app.get('/', mainHandler); |
156 | -app.post('/', express.urlencoded({ extended: true }), mainHandler); | |
171 | +app.post( | |
172 | + '/', | |
173 | + express.urlencoded({ extended: true }), | |
174 | + express.json(), | |
175 | + mainHandler, | |
176 | +); | |
157 | 177 | |
158 | 178 | app.listen(port, () => { |
159 | 179 | logger.info('HTTP-LISTENER: started', { |
package-lock.json
1 | 1 | { |
2 | 2 | "name": "komodo-center-messaging", |
3 | - "version": "0.14.11", | |
3 | + "version": "0.14.12", | |
4 | 4 | "lockfileVersion": 2, |
5 | 5 | "requires": true, |
6 | 6 | "packages": { |
7 | 7 | "": { |
8 | 8 | "name": "komodo-center-messaging", |
9 | - "version": "0.14.11", | |
9 | + "version": "0.14.12", | |
10 | 10 | "license": "ISC", |
11 | 11 | "dependencies": { |
12 | 12 | "auto-changelog": "^2.3.0", |