(response *http.Response)
| 6284 | } |
| 6285 | |
| 6286 | func readAPIError(response *http.Response) error { |
| 6287 | body, err := io.ReadAll(io.LimitReader(response.Body, 1<<20)) |
| 6288 | if err != nil { |
| 6289 | return fmt.Errorf("cli: read api error response: %w", err) |
| 6290 | } |
| 6291 | return readAPIErrorBody(response.StatusCode, response.Status, body) |
| 6292 | } |
| 6293 | |
| 6294 | func readAPIErrorBody(statusCode int, status string, body []byte) error { |
| 6295 | var payload struct { |