Merge 675838ec999411f1ed5b3e3d88de0e6f483824a2 into 5f4f9643258dc2a65e684b63f12c8d543c936c67

This commit is contained in:
Raju Ahmed 2026-05-11 08:53:52 +06:00 committed by GitHub
commit e0ab33e851
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

@ -33,12 +33,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{}