Skip to content

Commit

Permalink
doc: add notes on httptest.ResponseRecorder
Browse files Browse the repository at this point in the history
  • Loading branch information
nanmu42 committed Sep 18, 2021
1 parent 2feb5f4 commit 4c35c5d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion writerwrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,12 @@ func Test_writeWrapper_does_not_change_status_code_after_204(t *testing.T) {
_, _ = wrapper.Write([]byte("something"))

assert.Equal(t, http.StatusNoContent, recorder.Code)
}
// httptest.ResponseRecorder does not deny Write when status code is 204 or 304.
// n, err := wrapper.Write([]byte("something"))
// assert.Equal(t, 0, n)
// assert.Error(t, err)
// assert.Equal(t, http.StatusNoContent, recorder.Code)
// assert.Equal(t, []byte{}, recorder.Body.Bytes())
//
// ref: https://github.com/nanmu42/gzip/pull/5
}

0 comments on commit 4c35c5d

Please sign in to comment.