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

Closed
kkroo opened this issue May 11, 2020 · 4 comments
Closed

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

kkroo opened this issue May 11, 2020 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Unfortunate
Milestone

Comments

@kkroo
Copy link

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

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

@mdlayher
Copy link
Member

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 the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 11, 2020
@toothrot toothrot added this to the Backlog milestone May 11, 2020
@toothrot
Copy link
Contributor

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

@seankhliao
Copy link
Member

closing as unfortunate

@golang golang locked and limited conversation to collaborators Jun 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Unfortunate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants