Skip to content

Commit

Permalink
middleware: fix Compress to return passed down status code
Browse files Browse the repository at this point in the history
  • Loading branch information
pkieltyka committed Jan 17, 2019
1 parent e952037 commit 1a6bb10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions middleware/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (w *compressResponseWriter) WriteHeader(code int) {
return
}
w.wroteHeader = true
defer w.WriteHeader(code)
defer w.ResponseWriter.WriteHeader(code)

// Already compressed data?
if w.Header().Get("Content-Encoding") != "" {
Expand Down Expand Up @@ -225,7 +225,7 @@ func (w *compressResponseWriter) WriteHeader(code int) {

func (w *compressResponseWriter) Write(p []byte) (int, error) {
if !w.wroteHeader {
w.WriteHeader(http.StatusOK)
w.ResponseWriter.WriteHeader(http.StatusOK)
}

return w.w.Write(p)
Expand Down

0 comments on commit 1a6bb10

Please sign in to comment.