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

chore: use HeadersArray instead of Headers object on the server side #3512

Merged
merged 1 commit into from
Aug 18, 2020
Merged

chore: use HeadersArray instead of Headers object on the server side #3512

merged 1 commit into from
Aug 18, 2020

Conversation

dgozman
Copy link
Contributor

@dgozman dgozman commented Aug 18, 2020

This simplifies implementation and avoids multiple conversions.
Also adding some tests around lowercase and wrong types.

This simplifies implementation and avoids multiple conversions.
Also adding some tests around lowercase and wrong types.
src/converters.ts Show resolved Hide resolved
src/converters.ts Show resolved Hide resolved
const headers = (this._page._state.extraHTTPHeaders || {});
let referer = headers['referer'] || headers['Referer'];
const headers = this._page._state.extraHTTPHeaders || [];
const refererHeader = headers.find(h => h.name === 'referer' || h.name === 'Referer');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it used to be like this before, but why not

h => h.name.toLowerCase() === 'referer'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. I'll follow up 😄

@dgozman dgozman merged commit aeadf50 into microsoft:master Aug 18, 2020
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.

2 participants