(resp *http.Response)
| 101 | } |
| 102 | |
| 103 | func statusCodeError(resp *http.Response) error { |
| 104 | if resp.Header.Get("X-Go-Pprof") != "" && |
| 105 | strings.Contains(resp.Header.Get("Content-Type"), "text/plain") { |
| 106 | if body, err := io.ReadAll(resp.Body); err == nil { |
| 107 | return fmt.Errorf("server response: %s - %s", resp.Status, body) |
| 108 | } |
| 109 | } |
| 110 | return fmt.Errorf("server response: %s", resp.Status) |
| 111 | } |