|
|
@ -117,7 +117,7 @@ func (a *BasicTransferAdapter) performRequest(ctx context.Context, method string |
|
|
|
func handleErrorResponse(resp *http.Response) error { |
|
|
|
func handleErrorResponse(resp *http.Response) error { |
|
|
|
defer resp.Body.Close() |
|
|
|
defer resp.Body.Close() |
|
|
|
|
|
|
|
|
|
|
|
er, err := decodeReponseError(resp.Body) |
|
|
|
er, err := decodeResponseError(resp.Body) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("Request failed with status %s", resp.Status) |
|
|
|
return fmt.Errorf("Request failed with status %s", resp.Status) |
|
|
|
} |
|
|
|
} |
|
|
@ -125,7 +125,7 @@ func handleErrorResponse(resp *http.Response) error { |
|
|
|
return errors.New(er.Message) |
|
|
|
return errors.New(er.Message) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func decodeReponseError(r io.Reader) (ErrorResponse, error) { |
|
|
|
func decodeResponseError(r io.Reader) (ErrorResponse, error) { |
|
|
|
var er ErrorResponse |
|
|
|
var er ErrorResponse |
|
|
|
err := json.NewDecoder(r).Decode(&er) |
|
|
|
err := json.NewDecoder(r).Decode(&er) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|