From bcdfe82995862c6726cd396cd0a625c0c3844b3d Mon Sep 17 00:00:00 2001 From: Marcin Jahn Date: Sat, 21 Jan 2023 10:05:27 +0100 Subject: [PATCH] fix(http) Remove outgoing headers normalization --- experimental/CHANGELOG.md | 2 ++ .../opentelemetry-instrumentation-http/src/utils.ts | 8 -------- .../test/functionals/http-enable.test.ts | 5 ----- .../test/functionals/https-enable.test.ts | 7 +------ 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/experimental/CHANGELOG.md b/experimental/CHANGELOG.md index 9416823ca2a..bf48c1b9dc4 100644 --- a/experimental/CHANGELOG.md +++ b/experimental/CHANGELOG.md @@ -10,6 +10,8 @@ All notable changes to experimental packages in this project will be documented ### :bug: (Bug Fix) +* fix(http) Remove outgoing headers normalization [#3557](/~https://github.com/open-telemetry/opentelemetry-js/pull/3557) @marcinjahn + ### :books: (Refine Doc) ### :house: (Internal) diff --git a/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts b/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts index 4f91ad4cfdc..c9a178653ef 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/src/utils.ts @@ -276,14 +276,6 @@ export const getRequestInfo = ( origin = `${optionsParsed.protocol || 'http:'}//${hostname}`; } - const headers = optionsParsed.headers ?? {}; - optionsParsed.headers = Object.keys(headers).reduce( - (normalizedHeader, key) => { - normalizedHeader[key.toLowerCase()] = headers[key]; - return normalizedHeader; - }, - {} as OutgoingHttpHeaders - ); // some packages return method in lowercase.. // ensure upperCase for consistency const method = optionsParsed.method diff --git a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts index fb10580739c..9ebfe41c80f 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/http-enable.test.ts @@ -508,11 +508,6 @@ describe('HttpInstrumentation', () => { 'user-agent': testValue, }, }), - httpRequest.get(`${protocol}://${hostname}:${serverPort}`, { - headers: { - 'uSeR-aGeNt': testValue, - }, - }), ]); const spans = memoryExporter.getFinishedSpans(); assert.strictEqual(spans.length, 0); diff --git a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts index 8ca18c5e984..78e497487ee 100644 --- a/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts +++ b/experimental/packages/opentelemetry-instrumentation-http/test/functionals/https-enable.test.ts @@ -459,12 +459,7 @@ describe('HttpsInstrumentation', () => { headers: { 'user-agent': testValue, }, - }), - httpsRequest.get(`${protocol}://${hostname}:${serverPort}`, { - headers: { - 'uSeR-aGeNt': testValue, - }, - }), + }) ]); const spans = memoryExporter.getFinishedSpans(); assert.strictEqual(spans.length, 0);