更新 proxy/handler.go

This commit is contained in:
XOF
2025-12-15 03:44:12 +08:00
parent 510e129499
commit 3b264d7282

View File

@@ -158,8 +158,9 @@ func (h *ProxyHandler) rewriteContent(body []byte, targetURL, contentType string
func (h *ProxyHandler) readResponseBody(resp *http.Response) ([]byte, error) {
var reader io.Reader = resp.Body
// 处理 gzip 压缩
if resp.Header.Get("Content-Encoding") == "gzip" {
// 处理各种压缩格式
encoding := strings.ToLower(resp.Header.Get("Content-Encoding"))
if strings.Contains(encoding, "gzip") {
gzReader, err := gzip.NewReader(resp.Body)
if err != nil {
return nil, err