commit | f192891786893c9352e15698159b3929057cdb7e | [log] [tgz] |
---|---|---|
author | Brad Fitzpatrick <bradfitz@golang.org> | Tue Mar 15 10:13:25 2011 -0700 |
committer | Brad Fitzpatrick <bradfitz@golang.org> | Tue Mar 15 10:13:25 2011 -0700 |
tree | 1a4db016ac81f72c0f5b24b558cd2891f2c6d54d | |
parent | 5245b27ed8e8e172f627e247415cbf9c758813ae [diff] [blame] |
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
diff --git a/src/pkg/http/httptest/recorder.go b/src/pkg/http/httptest/recorder.go index 8d70c28..0dd19a6 100644 --- a/src/pkg/http/httptest/recorder.go +++ b/src/pkg/http/httptest/recorder.go
@@ -42,6 +42,9 @@ if rw.Body != nil { rw.Body.Write(buf) } + if rw.Code == 0 { + rw.Code = http.StatusOK + } return len(buf), nil }