Skip to content

Commit

Permalink
add zstd encoding support
Browse files Browse the repository at this point in the history
  • Loading branch information
dogancanbakir committed Jul 17, 2024
1 parent fb0e84d commit 6d95188
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions http/normalization.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"strings"

"github.com/andybalholm/brotli"
"github.com/klauspost/compress/zstd"
"github.com/pkg/errors"
"golang.org/x/text/encoding/simplifiedchinese"
"golang.org/x/text/transform"
Expand Down Expand Up @@ -73,6 +74,13 @@ func wrapDecodeReader(resp *http.Response) (rc io.ReadCloser, err error) {
rc, err = zlib.NewReader(resp.Body)
case "br":
rc = io.NopCloser(brotli.NewReader(resp.Body))
case "zstd":
var zstdReader *zstd.Decoder
zstdReader, err = zstd.NewReader(resp.Body)
if err != nil {
return nil, err
}
rc = io.NopCloser(zstdReader)
default:
rc = resp.Body
}
Expand Down

0 comments on commit 6d95188

Please sign in to comment.