transformUnstructuredResponseError handles an error from the server that is not in a structured form. It is expected to transform any response that is not recognizable as a clear server sent error from the K8S API using the information provided with the request. In practice, HTTP proxies and client
(resp *http.Response, req *http.Request, body []byte)
| 971 | // |
| 972 | // TODO: introduce transformation of generic http.Client.Do() errors that separates 4. |
| 973 | func (r *Request) transformUnstructuredResponseError(resp *http.Response, req *http.Request, body []byte) error { |
| 974 | if body == nil && resp.Body != nil { |
| 975 | if data, err := ioutil.ReadAll(&io.LimitedReader{R: resp.Body, N: maxUnstructuredResponseTextBytes}); err == nil { |
| 976 | body = data |
| 977 | } |
| 978 | } |
| 979 | retryAfter, _ := retryAfterSeconds(resp) |
| 980 | return r.newUnstructuredResponseError(body, isTextResponse(resp), resp.StatusCode, req.Method, retryAfter) |
| 981 | } |
| 982 | |
| 983 | // newUnstructuredResponseError instantiates the appropriate generic error for the provided input. It also logs the body. |
| 984 | func (r *Request) newUnstructuredResponseError(body []byte, isTextResponse bool, statusCode int, method string, retryAfter int) error { |
no test coverage detected