Skip to content

Commit 4682772

Browse files
authored
Merge branch 'master' into global
2 parents ac6da8f + 637f982 commit 4682772

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

packages/opentelemetry-plugin-http/src/http.ts

+2
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ export class HttpPlugin extends BasePlugin<Http> {
406406
);
407407

408408
if (utils.isOpenTelemetryRequest(optionsParsed)) {
409+
// clone the headers so delete will not modify the user's object
410+
optionsParsed.headers = Object.assign({}, optionsParsed.headers);
409411
delete optionsParsed.headers[utils.OT_REQUEST_HEADER];
410412
return original.apply(this, [optionsParsed, ...args]);
411413
}

packages/opentelemetry-plugin-http/test/functionals/http-enable.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ describe('HttpPlugin', () => {
202202
const spans = memoryExporter.getFinishedSpans();
203203
assert.strictEqual(result.data, 'Ok');
204204
assert.strictEqual(spans.length, 0);
205+
assert.strictEqual(options.headers[OT_REQUEST_HEADER], 1);
205206
});
206207
});
207208
describe('with good plugin options', () => {

0 commit comments

Comments
 (0)