aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2011-03-15 10:13:25 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2011-03-15 10:13:25 -0700
commitf192891786893c9352e15698159b3929057cdb7e (patch)
tree1a4db016ac81f72c0f5b24b558cd2891f2c6d54d
parent5245b27ed8e8e172f627e247415cbf9c758813ae (diff)
downloadgo-f192891786893c9352e15698159b3929057cdb7e.tar.gz
go-f192891786893c9352e15698159b3929057cdb7e.zip
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
-rw-r--r--src/pkg/http/httptest/recorder.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pkg/http/httptest/recorder.go b/src/pkg/http/httptest/recorder.go
index 8d70c2834a..0dd19a617c 100644
--- a/src/pkg/http/httptest/recorder.go
+++ b/src/pkg/http/httptest/recorder.go
@@ -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
}