You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
Applies to all operating systems and architectures
What did you do?
Used net/http/httptest to test a net/http server.
What did you expect to see?
Behavior from net/http/httptest accurately reflects that of net/http.
What did you see instead?
When an HTTP status code is provided to net/http's response.WriteHeader which is outside of the range 100 to 999, inclusive, a panic is documented to occur as intended behavior. This is documented here, which is called from response.WriteHeader.
When an HTTP status code is provided to net/http/httptest's response.WriteHeader, it is stored as successfully sent for later access regardless of whether the status code falls outside the 100 to 999 range. This is documented here.
The ResponseRecorder exposed by net/http/httptest is inconsistent with the net/http behavior it is designed to test.
The text was updated successfully, but these errors were encountered:
talglobus
changed the title
x/net: net/http/httptest presents status codes that net/http will not send as sent
net/http: net/http/httptest presents status codes that net/http will not send as sent
Apr 2, 2021
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Applies to all operating systems and architectures
What did you do?
Used
net/http/httptest
to test anet/http
server.What did you expect to see?
Behavior from
net/http/httptest
accurately reflects that ofnet/http
.What did you see instead?
When an HTTP status code is provided to
net/http
'sresponse.WriteHeader
which is outside of the range 100 to 999, inclusive, a panic is documented to occur as intended behavior. This is documented here, which is called fromresponse.WriteHeader
.When an HTTP status code is provided to
net/http/httptest
'sresponse.WriteHeader
, it is stored as successfully sent for later access regardless of whether the status code falls outside the 100 to 999 range. This is documented here.The
ResponseRecorder
exposed bynet/http/httptest
is inconsistent with thenet/http
behavior it is designed to test.The text was updated successfully, but these errors were encountered: