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: Status shouldn't include StatusCode #38996

Open
kkroo opened this issue May 11, 2020 · 3 comments · May be fixed by #38997
Open

net/http: Status shouldn't include StatusCode #38996

kkroo opened this issue May 11, 2020 · 3 comments · May be fixed by #38997

Comments

@kkroo
Copy link

@kkroo kkroo commented May 11, 2020

In parsing: HTTP/1.1 200 OK

StatusCode is correctly set to 200 but Status is parsed to 200 OK when it should only be OK. This leads to inconsistency with http.StatusText which only returns OK instead of 200 OK

https://github.com/golang/go/blob/master/src/net/http/response.go#L176
https://github.com/golang/go/blob/master/src/net/http/status.go#L85

@gopherbot
Copy link

@gopherbot gopherbot commented May 11, 2020

Change https://golang.org/cl/233201 mentions this issue: net/http: remove redundant numeric StatusCode from Status message

@mdlayher
Copy link
Member

@mdlayher mdlayher commented May 11, 2020

I suspect it is too late to modify this behavior, since the field is documented to return a string in https://golang.org/pkg/net/http/#Response.

@mdlayher mdlayher changed the title HTTP Status shouldn't include StatusCode net/http: Status shouldn't include StatusCode May 11, 2020
@toothrot toothrot added this to the Backlog milestone May 11, 2020
@toothrot
Copy link
Contributor

@toothrot toothrot commented May 11, 2020

I don't see how this can be changed without breaking a lot of software. The current code is behaving as documented.

/cc @bradfitz @rsc

@bcmills bcmills added the Unfortunate label May 11, 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.

5 participants
You can’t perform that action at this time.