From 443ad67c9d885650ff35203b8440310a69536b8f Mon Sep 17 00:00:00 2001 From: "Xin,Zhang" Date: Thu, 5 Mar 2020 17:56:17 +0800 Subject: [PATCH] fix headers may be null value at some situation (#96) --- modules/nodejs-agent/lib/plugins/http/http.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nodejs-agent/lib/plugins/http/http.js b/modules/nodejs-agent/lib/plugins/http/http.js index d60655e..d759f37 100644 --- a/modules/nodejs-agent/lib/plugins/http/http.js +++ b/modules/nodejs-agent/lib/plugins/http/http.js @@ -96,7 +96,7 @@ module.exports = function(httpModule, instrumentation, contextManager) { let contextCarrier = new ContextCarrier(); let span = contextManager.createExitSpan(options.path, options.host + ":" + options.port, contextCarrier); contextCarrier.pushBy(function(key, value) { - if (!options.hasOwnProperty("headers")) { + if (!options.hasOwnProperty("headers") || !options.headers) { options.headers = {}; } options.headers[key] = value; -- GitLab