更新 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) {
|
func (h *ProxyHandler) readResponseBody(resp *http.Response) ([]byte, error) {
|
||||||
var reader io.Reader = resp.Body
|
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)
|
gzReader, err := gzip.NewReader(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user