Skip to content

Conversation

@zhu1230
Copy link

@zhu1230 zhu1230 commented Oct 8, 2018

the headers.set method could cause the Uncaught TypeError via the validation on headers, however this is not captured inside the event callback, which causes the exit of the whole application.

replicate:

require('node-fetch')('http://bit.ly/hergivenhairKeeb', {redirect: 'manual'})

got:

TypeError: http://xn--www-4m0aa�.hergivenhair.com/?y=MAKEBA112 is not a legal HTTP header value

I thought about the testing, however it's not trivial to set up the test to return the invalid url, since the node.js serverResponse wouldn't allow invalid head name/value, I can capture a record(via nockBack), but that's kind of overkill maybe?

Thanks.

@bitinn
Copy link
Collaborator

bitinn commented Nov 13, 2018

This is now in v2.3.0 release, I haven't found a way to test it with nodejs due to header sanitization, but I believe it should now reject such redirect properly.

https://runkit.com/embed/0cst99egdxk6

@bitinn bitinn closed this Nov 13, 2018
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