-
-
Notifications
You must be signed in to change notification settings - Fork 957
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
Check protocol before sending request #295
Conversation
path: '', | ||
retries: 5 | ||
}, | ||
url, | ||
{ | ||
protocol: url.protocol || 'http:' // Override both null/undefined with default protocol | ||
}, | ||
opts | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
urlParseLax
returns null
for all properties that weren't parsed, so protocol: null
used to take over the default protocol: 'http:'
all the time for protocol-less urls; this change remedies that.
Thanks @pioul :) |
👍 @sindresorhus Of course! Just realizing now that there's a bit of doc I haven't updated if you want to quickly add a line there: https://github.com/sindresorhus/got#errors By the way, how often are you releasing? I'd love to take advantage of that addition in a dependent (probe-image-size) once the next release is out :) |
Readme updated. I missed it too. Right now we're targeting a new major release in a couple of weeks. |
Thanks, sounds great! |
Fixes #294 by making sure an url has a valid protocol (http/https) before sending a request.
Let me know if any other tweak would make sense before merging this PR!