Skip to content

Commit

Permalink
fix(header): write content-encoding when unset
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbonnet committed Mar 17, 2021
1 parent 9672923 commit f1a4099
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/writeContentEncoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ export async function writeContentEncoding(request, next) {
if (response.headersSent) {
return response
}
if (acceptedEncoding && response.compress) {
response.setHeader('content-encoding', acceptedEncoding)
if (
acceptedEncoding &&
!response.hasHeader('Content-Encoding') &&
response.compress
) {
response.setHeader('Content-Encoding', acceptedEncoding)
return response
}
if (response.compress) {
Expand Down

0 comments on commit f1a4099

Please sign in to comment.