-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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 StatusCode and 404s #21846
Comments
200-299,400-599 status codes may have headers and bodies, that's a lot to
overload on an error implementation.
…On Tue, 12 Sep 2017, 21:56 Gregory Reshetniak ***@***.***> wrote:
I'd argue that resp, err := http.Get("http://google.com/foo/bar") not
having any err's but resp.StatusCode indicating 404 is misleading.
If 404 and 500 are not errors, what are? Why are there 2 types of errors?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#21846>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA4qsBOWa1uDCxXKFp0BdfSOYmN66ks5shnGDgaJpZM4PUh_M>
.
|
I'm pretty sure this is already documented. (on phone) |
The documentation:
Also note that, on top of what @davecheney said, making 4xx and 5xx status codes also errors would break the Go1 compatibility promise. |
Is there a catchall non-error return code object to match against? I mean, having != 200,201,301,302 etc etc is a lot of boilerplate to simply make sure my request has made it. |
There doesn'r seem to be a bug here, so I'm closing this. If you'd like to change how net/http works, feel free to submit a proposal. |
I'd argue that
resp, err := http.Get("http://google.com/foo/bar")
not having any err's but resp.StatusCode indicating 404 is misleading.If 404 and 500 are not errors, what are? Why are there 2 types of errors?
The text was updated successfully, but these errors were encountered: