MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / WrapHTTPResponse

Function WrapHTTPResponse

internal/compressions/utils.go:74–92  ·  view source on GitHub ↗

WrapHTTPResponse 包装http.Response对象

(resp *http.Response)

Source from the content-addressed store, hash-verified

72
73// WrapHTTPResponse 包装http.Response对象
74func WrapHTTPResponse(resp *http.Response) {
75 if resp == nil {
76 return
77 }
78
79 var contentEncoding = resp.Header.Get("Content-Encoding")
80 if len(contentEncoding) == 0 || !SupportEncoding(contentEncoding) {
81 return
82 }
83
84 reader, err := NewReader(resp.Body, contentEncoding)
85 if err != nil {
86 // unable to decode, we ignore the error
87 return
88 }
89 resp.Header.Del("Content-Encoding")
90 resp.Header.Del("Content-Length")
91 resp.Body = reader
92}
93
94// 系统CPU线程数
95var countCPU = runtime.NumCPU()

Callers

nothing calls this directly

Calls 3

SupportEncodingFunction · 0.85
NewReaderFunction · 0.85
GetMethod · 0.45

Tested by

no test coverage detected