From f192891786893c9352e15698159b3929057cdb7e Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 15 Mar 2011 10:13:25 -0700 Subject: [PATCH] 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 --- src/pkg/http/httptest/recorder.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pkg/http/httptest/recorder.go b/src/pkg/http/httptest/recorder.go index 8d70c2834a1..0dd19a617cc 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 }