Skip to content

Commit

Permalink
fix tests and add a new one
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Dec 10, 2024
1 parent c9a29db commit 8d791d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions caddytest/integration/caddyfile_adapt/encode_options.caddyfiletest
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ encode {
zstd
gzip 5
}

encode
----------
{
"apps": {
Expand Down Expand Up @@ -76,6 +78,17 @@ encode {
"zstd",
"gzip"
]
},
{
"encodings": {
"gzip": {},
"zstd": {}
},
"handler": "encode",
"prefer": [
"zstd",
"gzip"
]
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions modules/caddyhttp/encode/caddyfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ func (enc *Encode) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
}
}

if len(prefer) == 0 {
prefer = []string{"zstd", "gzip"}
if len(prefer) == 0 && len(remainingArgs) == 0 {
remainingArgs = []string{"zstd", "gzip"}
}

for _, arg := range remainingArgs {
Expand Down

0 comments on commit 8d791d5

Please sign in to comment.