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

Makes sure the headers are processed right before making a request #101

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mrctrifork
Copy link

The bug occurs because treaty "lower cases" all header values (not sure exactly why; I'd do nothing to them and let the platform handle the logic)

Since seems that some code got copy-pasted; and the latter appearance of the code copy-pasted code didn't process the headers it accumulated the headers as follows:

// headers
{
  authorization: 'Bearer token',
  Authorization: 'Bearer token'
}
const request = new Request({
    headers: {
        authorization: 'Bearer token',
        Authorization: 'Bearer token'
    }
})

console.log(request.header.get('Authorization')) // prints "Bearer token, Bearer token"

The fix is to remove the duplicated logic at the top and ensure "processHeaders" gets called.

closes #100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicated values when passing uppercase values for headers
2 participants