更新 proxy/handler.go
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user