(response *http.Response, err error)
| 340 | } |
| 341 | |
| 342 | func (gohanClientCLI *GohanClientCLI) handleResponse(response *http.Response, err error) (interface{}, error) { |
| 343 | if response == nil { |
| 344 | return nil, fmt.Errorf(noResponseError) |
| 345 | } |
| 346 | defer response.Body.Close() |
| 347 | var result interface{} |
| 348 | json.NewDecoder(response.Body).Decode(&result) |
| 349 | |
| 350 | gohanClientCLI.logResponse(response.Status, result) |
| 351 | |
| 352 | if response.StatusCode == http.StatusNotFound { |
| 353 | return nil, fmt.Errorf(resourceNotFoundError) |
| 354 | } |
| 355 | if err != nil { |
| 356 | return nil, fmt.Errorf(unexpectedResponse, response.Status) |
| 357 | } |
| 358 | |
| 359 | return result, err |
| 360 | } |
| 361 | |
| 362 | func (gohanClientCLI *GohanClientCLI) getFieldsParam(prependQuestionMark bool) string { |
| 363 | if len(gohanClientCLI.opts.fields) == 0 { |
no test coverage detected