Skip to content

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