node-fetch / node-fetch Public
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
fix(Redirect): Better handle wrong redirect header in a response #1387
fix(Redirect): Better handle wrong redirect header in a response #1387
Conversation
Just thought of something... and i tested this in chrome... if you have
so i tested it in firefox, and safari also // FF OK
fetch('/redirect/301/invalid', { redirect: 'manual' }).then(console.log, console.error)
// Safari OK
fetch('/redirect/301/invalid', { redirect: 'manual' }).then(console.log, console.error)
// Chrome Throws
fetch('/redirect/301/invalid', { redirect: 'manual' }).then(console.log, console.error) We should have a test case for both.
Should also report this to Chrome / WPT |
Reported it to chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=1271920 |
Made some changes
|
Do you need anything else from my end here? |
Purpose
Fixes crash when a Location header point to an invalid URL
Changes
Just wrapping
new URL()
in a try/catch and returning a sensible (?) error messageAdditional information
Test included