1
0
Fork 0

Passing the correct status code when compression is disabled within the Brotli handler

Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
This commit is contained in:
Romain 2024-06-05 15:04:04 +02:00 committed by GitHub
parent 6ca4c5da5c
commit 6155c900be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View file

@ -160,6 +160,7 @@ func (r *responseWriter) Write(p []byte) (int, error) {
}
if !found {
r.compressionDisabled = true
r.rw.WriteHeader(r.statusCode)
return r.rw.Write(p)
}
}
@ -167,6 +168,7 @@ func (r *responseWriter) Write(p []byte) (int, error) {
for _, excludedContentType := range r.excludedContentTypes {
if excludedContentType.equals(mediaType, params) {
r.compressionDisabled = true
r.rw.WriteHeader(r.statusCode)
return r.rw.Write(p)
}
}