Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix fetch instrumentation not handling headers array correctly #790

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

t2t2
Copy link
Contributor

@t2t2 t2t2 commented Jun 4, 2024

Description

Other than object ({'X-Test': 'value'}) and Headers object, there's a third way to pass headers into fetch api of [name, value][] ([['X-Test', 'value']]) (spec). This currently isn't handled correctly in otel's fetch instrumentation, ending up converting the array into object {0: 'X-Test,value'}

Bypassing the bug for now by converting the array into a Headers object

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

  • Manual testing
fetch('/some-data', {headers: [['X-Test', 'value']]}).then(response => response.json()).then(console.log);

@t2t2 t2t2 requested review from a team as code owners June 4, 2024 15:45
@t2t2 t2t2 merged commit abe2e12 into main Jun 5, 2024
6 checks passed
@t2t2 t2t2 deleted the fetch-headers-array branch June 5, 2024 10:17
@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants