diff --git a/http/normalization.go b/http/normalization.go index 89cceac..9c44eb9 100644 --- a/http/normalization.go +++ b/http/normalization.go @@ -2,14 +2,15 @@ package httputil import ( "bytes" - "compress/gzip" - "compress/zlib" "fmt" "io" "net/http" "strings" - "github.com/andybalholm/brotli" + "github.com/dsnet/compress/brotli" + "github.com/klauspost/compress/gzip" + "github.com/klauspost/compress/zlib" + "github.com/klauspost/compress/zstd" "github.com/pkg/errors" "golang.org/x/text/encoding/simplifiedchinese" "golang.org/x/text/transform" @@ -72,7 +73,14 @@ func wrapDecodeReader(resp *http.Response) (rc io.ReadCloser, err error) { case "deflate": rc, err = zlib.NewReader(resp.Body) case "br": - rc = io.NopCloser(brotli.NewReader(resp.Body)) + rc, err = brotli.NewReader(resp.Body, nil) + 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 }