diff --git a/response.go b/response.go index 0f174536d..ab2bb85d7 100644 --- a/response.go +++ b/response.go @@ -5,6 +5,7 @@ package echo import ( "bufio" + "fmt" "errors" "net" "net/http" @@ -88,7 +89,7 @@ func (r *Response) Write(b []byte) (n int, err error) { func (r *Response) Flush() { err := http.NewResponseController(r.Writer).Flush() if err != nil && errors.Is(err, http.ErrNotSupported) { - panic(errors.New("response writer flushing is not supported")) + panic(fmt.Errorf("echo: response writer %T does not support flushing (http.Flusher interface)", r.Writer)) } } diff --git a/response_test.go b/response_test.go index 70cba9776..f7a0fafba 100644 --- a/response_test.go +++ b/response_test.go @@ -80,7 +80,7 @@ func TestResponse_FlushPanics(t *testing.T) { res := &Response{echo: e, Writer: rw} // we test that we behave as before unwrapping flushers - flushing writer that does not support it causes panic - assert.PanicsWithError(t, "response writer flushing is not supported", func() { + assert.PanicsWithError(t, "echo: response writer *echo.testResponseWriter does not support flushing (http.Flusher interface)", func() { res.Flush() }) }