Skip to content

Commit

Permalink
fix: dont add vary value when it is a wildcard
Browse files Browse the repository at this point in the history
  • Loading branch information
vermaysha committed Jun 4, 2024
1 parent 2689a06 commit f5c1776
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,13 @@ export const compression = (
const headerValueArray = Array.isArray(rawHeaderValue)
? rawHeaderValue
: [rawHeaderValue]
if (!headerValueArray.some((h) => h.includes('accept-encoding'))) {

// Add accept-encoding header if it doesn't exist
// and if vary not set to *
if (
!headerValueArray.some((h) => h.includes('accept-encoding')) &&
!headerValueArray.includes('*')
) {
headers.Vary = headerValueArray.concat('accept-encoding').join(', ')
}
} else {
Expand Down

0 comments on commit f5c1776

Please sign in to comment.