diff --git a/middleware/wrap_writer.go b/middleware/wrap_writer.go index bf270881..12d4faf0 100644 --- a/middleware/wrap_writer.go +++ b/middleware/wrap_writer.go @@ -81,7 +81,11 @@ type basicWriter struct { } func (b *basicWriter) WriteHeader(code int) { - if !b.wroteHeader { + if code >= 100 && code <= 199 && code != http.StatusSwitchingProtocols { + if !b.discard { + b.ResponseWriter.WriteHeader(code) + } + } else if !b.wroteHeader { b.code = code b.wroteHeader = true if !b.discard {