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

Check protocol before sending request #295

Merged
merged 1 commit into from
May 5, 2017
Merged

Check protocol before sending request #295

merged 1 commit into from
May 5, 2017

Conversation

philippe-git
Copy link
Contributor

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!

path: '',
retries: 5
},
url,
{
protocol: url.protocol || 'http:' // Override both null/undefined with default protocol
},
opts
);
Copy link
Contributor Author

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.

@sindresorhus sindresorhus merged commit 5476917 into sindresorhus:master May 5, 2017
@sindresorhus
Copy link
Owner

Thanks @pioul :)

@philippe-git
Copy link
Contributor Author

👍 @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 :)

sindresorhus added a commit that referenced this pull request May 6, 2017
@sindresorhus
Copy link
Owner

Readme updated. I missed it too.

Right now we're targeting a new major release in a couple of weeks.

@philippe-git
Copy link
Contributor Author

Thanks, sounds great!

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.

None yet

3 participants