Skip to content

Commit

Permalink
fix: support non-lower-cased headers in LumigoW3CTraceContextPropagat…
Browse files Browse the repository at this point in the history
…or (#162)
  • Loading branch information
GuyMoses authored Mar 4, 2023
1 parent 5a50be7 commit 3684534
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/propagator/w3cTraceContextPropagator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ export class LumigoW3CTraceContextPropagator extends W3CTraceContextPropagator {
override inject(context: Context, carrier: unknown, setter: TextMapSetter): void {
if (typeof carrier === 'object') {
for (const key of contextKeysSkipInject) {
if (key in carrier) {
if (
Object.keys(carrier)
.map((key) => key.toLowerCase())
.includes(key)
) {
diag.debug(`Skipping injection of trace context due to key '${key}' in carrier`);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion test/component/http/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const requestListener = async function (req, res) {
// We expect this to throw due to the timeout + impossibility to connect
await axios.get(`https://httpbin.org/status/201`, {
headers: {
'x-amz-content-sha256': 'abcdefghi',
'x-aMz-cOntEnt-sHa256': 'abcdefghi', // Creative upper-casing, but only marginally less insane than Amazon's :-)
},
timeout: 5_000, // Milliseconds
});
Expand Down

0 comments on commit 3684534

Please sign in to comment.