diff --git a/response.go b/response.go index caa191bf..2a76607b 100644 --- a/response.go +++ b/response.go @@ -76,6 +76,7 @@ func (r *Response) Size() int64 { func (r *Response) reset(w http.ResponseWriter) { r.writer = w + r.size = 0 r.status = http.StatusOK r.committed = false } diff --git a/response_test.go b/response_test.go index e1e966f6..f7296c2a 100644 --- a/response_test.go +++ b/response_test.go @@ -37,4 +37,10 @@ func TestResponse(t *testing.T) { if r.Size() != int64(len(s)) { t.Errorf("size should be %d", len(s)) } + + // reser + r.reset(httptest.NewRecorder()) + if r.Size() != int64(0) { + t.Error("size should be 0") + } }