diff --git a/modules/nodejs-agent/lib/plugins/http/http.js b/modules/nodejs-agent/lib/plugins/http/http.js index d60655ed2760009018de7746a27e43f44da5f49e..d759f3720b29ccd674b7d3a56293ee36f2678482 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;