Merge 675838ec999411f1ed5b3e3d88de0e6f483824a2 into dcaa4296d111981ffb31ac3eba90bb63e1eb5ab9

This commit is contained in:
Raju Ahmed 2026-08-22 20:24:04 -07:00 committed by GitHub
commit d303478e44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -44,6 +44,9 @@ type ResponseWriter interface {
// Pusher get the http.Pusher for server push
Pusher() http.Pusher
// Unwrap get the underlying http.ResponseWriter
Unwrap() http.ResponseWriter
}
type responseWriter struct {

View File

@ -56,12 +56,23 @@ func init() {
SetMode(TestMode)
}
// test for ResponseWriter.Unwrap
func TestResponseWriterUnwrap(t *testing.T) {
testWriter := httptest.NewRecorder()
writer := &responseWriter{ResponseWriter: testWriter}
assert.Same(t, testWriter, writer.Unwrap())
}
func TestResponseWriterUnwrapViaInterface(t *testing.T) {
testWriter := httptest.NewRecorder()
writer := &responseWriter{}
writer.reset(testWriter)
var w ResponseWriter = writer
unwrapped := w.Unwrap()
assert.Same(t, testWriter, unwrapped)
}
func TestResponseWriterReset(t *testing.T) {
testWriter := httptest.NewRecorder()
writer := &responseWriter{}