Skip to content

Commit 7a728a2

Browse files
committed
added working fallback if req.getHeader() is missing for plain http library
1 parent 32a4f97 commit 7a728a2

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

cf-nodejs-logging-support-plainhttp/log-plainhttp.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ var logNetwork = function (req, res) {
3030
}
3131

3232
if (typeof req.getHeader != "function") {
33-
req.getHeader = () => { return null; };
33+
req.getHeader = function (header) {
34+
return this.headers[header.toLocaleLowerCase()];
35+
};
3436
}
3537

3638
var token = req.headers[core.getDynLogLevelHeaderName()];

config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ var config = [
277277
mandatory: true,
278278
source: {
279279
type: "header",
280-
name: "X-CorrelationID"
280+
name: "x-correlationid"
281281
},
282282
fallback: (req, res, logObject) => {
283283
return uuid();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cf-nodejs-logging-support",
3-
"version": "5.2.1",
3+
"version": "5.2.2",
44
"description": "Logging tool for Cloud Foundry",
55
"keywords": [
66
"logging",

0 commit comments

Comments
 (0)