Skip to content

Throw instead of ignore, if headers are invalid#20

Closed
emmenko wants to merge 3 commits intonode-fetch:masterfrom
emmenko:validate-headers
Closed

Throw instead of ignore, if headers are invalid#20
emmenko wants to merge 3 commits intonode-fetch:masterfrom
emmenko:validate-headers

Conversation

@emmenko
Copy link
Copy Markdown

@emmenko emmenko commented May 3, 2015

After spending on hour trying to debug the problem, I found out that I was passing a number as header value, thus the header was ignored.

I think it would be much more useful throwing an error if something is not valid, instead of silently ignore it.

Thanks

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 62c0de4 on emmenko:validate-headers into 60f819f on bitinn:master.

@bitinn
Copy link
Copy Markdown
Collaborator

bitinn commented May 4, 2015

I would like to see how browsers and github polyfill handles it before making changes.

I would like to avoid throwing errors if possible, especially on value like null and undefined

@bitinn
Copy link
Copy Markdown
Collaborator

bitinn commented May 4, 2015

I have pushed a version 1.2.1 to normalize Number type instead (only for new Headers at the moment, you need to take care using .set or .append)

@bitinn bitinn closed this May 4, 2015
@emmenko
Copy link
Copy Markdown
Author

emmenko commented May 4, 2015

@bitinn perfect, that would do it as well! Thanks 👍

@emmenko emmenko deleted the validate-headers branch May 4, 2015 08:30
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.

3 participants