WrapHTTPResponse 包装http.Response对象
(resp *http.Response)
| 72 | |
| 73 | // WrapHTTPResponse 包装http.Response对象 |
| 74 | func 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线程数 |
| 95 | var countCPU = runtime.NumCPU() |
nothing calls this directly
no test coverage detected