Merge 675838ec999411f1ed5b3e3d88de0e6f483824a2 into d3ffc9985281dcf4d3bef604cce4e662b1a327a6

This commit is contained in:
Raju Ahmed 2026-03-27 07:41:32 +06:00 committed by GitHub
commit 172bc77cdf
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{}