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

net/http: client does not quote URL consistently like "protocol scheme" in returned errors #38421

Closed
as opened this issue Apr 13, 2020 · 2 comments
Closed

Comments

@as
Copy link
Contributor

@as as commented Apr 13, 2020

The HTTP client should quote the URL and protocol scheme consistently. Look at the result of this call to http.Get with an empty URL string:

fmt.Println(http.Get(""))
// <nil> Get : unsupported protocol scheme ""

I can't immediately see that there's an empty string in this output, I only see that the protocol is empty.

What did you expect to see?

<nil> Get "": unsupported protocol scheme ""

What did you see instead?

<nil> Get : unsupported protocol scheme ""

https://play.golang.org/p/ppBzVyfctb6

@smasher164 smasher164 changed the title http: client: quote URL consistently like "protocol scheme" in returned errors net/http: client does not quote URL consistently like "protocol scheme" in returned errors Apr 14, 2020
@mlowicki
Copy link
Contributor

@mlowicki mlowicki commented Apr 15, 2020

@as which version are you using? I've tested locally with go version go1.14.1 linux/arm and it looks fine:

<nil> Get "": unsupported protocol scheme ""

I've checked https://play.golang.org/p/ppBzVyfctb6 and I'm getting there:

<nil> Get "": unsupported protocol scheme ""
<nil> Get "example.com": unsupported protocol scheme ""
<nil> Get "ftp://example.com": unsupported protocol scheme "ftp"
@as
Copy link
Contributor Author

@as as commented Apr 20, 2020

The issue is not reproducible in the latest version. At the time of writing, the playground link successfully reproduced it (week ago). As of the latest version, it does not. Closing.

@as as closed this Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.