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
httptest.Recorder does not mimic the behavior of the real HTTP package when the handler
function does not explicitly call r.WriteHeader or r.Write. The real HTTP server will
return a status code of 200; but Recorder.Code will be 0.
For example with this no-op handler:
func myHandler(r http.ResponseWriter, rq *http.Request) {
}
Used in an actual server, the handler will always result in a status of 200.
But if called directly with an httptest.Recorder as the first parameter, the recorder's
Code will end up as 0, not 200.
The text was updated successfully, but these errors were encountered:
by Jens.Alfke:
The text was updated successfully, but these errors were encountered: