Skip to content

Commit

Permalink
use BestCompression in GzipEncoding
Browse files Browse the repository at this point in the history
This probably won't matter for modern browsers as they can use brotli/zstd, but there are still many curl installations that only support gzip (the same is also true for the default HTTP client in Go).
  • Loading branch information
CAFxX authored Aug 14, 2024
1 parent 7930c34 commit d400456
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,10 @@ func GzipEncoding() Encoding {
},
Encoder: func(r io.Reader) ([]byte, error) {
res := bytes.NewBuffer(nil)
w := gzip.NewWriter(res)
w, err := gzip.NewWriterLevel(res, gzip.BestCompression)
if err != nil {
return nil, err
}

Check notice on line 480 in server.go

View workflow job for this annotation

GitHub Actions / test (1.20.x)

1 statement(s) on lines 478:480 are not covered by tests.

if _, err := io.Copy(w, r); err != nil {
return nil, err
Expand Down

0 comments on commit d400456

Please sign in to comment.