Skip to content

Commit

Permalink
review.
Browse files Browse the repository at this point in the history
  • Loading branch information
juliens committed Sep 27, 2024
1 parent 6d73e43 commit 71a1e13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gzhttp/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,12 @@ func (w *GzipResponseWriter) Close() error {
ce = w.Header().Get(contentEncoding)
cr = w.Header().Get(contentRange)
)
if ct == "" && bodyAllowedForStatus(w.code) {
if ct == "" {
ct = http.DetectContentType(w.buf)

// Handles the intended case of setting a nil Content-Type (as for http/server or http/fs)
// Set the header only if the key does not exist
if _, ok := w.Header()[contentType]; w.setContentType && !ok {
if _, ok := w.Header()[contentType]; bodyAllowedForStatus(w.code) && w.setContentType && !ok {
w.Header().Set(contentType, ct)
}
}
Expand Down

0 comments on commit 71a1e13

Please sign in to comment.