mirror of
https://github.com/golang/go
synced 2024-11-21 19:04:44 -07:00
httptest: default the Recorder status code to 200 on a Write
This matches the real ResponseWriter behavior. R=rsc CC=golang-dev https://golang.org/cl/4291048
This commit is contained in:
parent
5245b27ed8
commit
f192891786
@ -42,6 +42,9 @@ func (rw *ResponseRecorder) Write(buf []byte) (int, os.Error) {
|
||||
if rw.Body != nil {
|
||||
rw.Body.Write(buf)
|
||||
}
|
||||
if rw.Code == 0 {
|
||||
rw.Code = http.StatusOK
|
||||
}
|
||||
return len(buf), nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user