Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Commit

Permalink
Do not return error in case of empty body
Browse files Browse the repository at this point in the history
Change-Id: Ie7a049537e4be0ca00ff7ceb3bc5afffe73823e8
  • Loading branch information
dukov committed Nov 16, 2019
1 parent fd2ad07 commit c62bc32
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ func parameterToJson(obj interface{}) (string, error) {
return string(jsonBuf), err
}


// callAPI do the request.
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
return c.cfg.HTTPClient.Do(request)
Expand Down Expand Up @@ -329,6 +328,9 @@ func (c *APIClient) prepareRequest(
}

func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
if len(b) == 0 {
return nil
}
if s, ok := v.(*string); ok {
*s = string(b)
return nil
Expand Down

0 comments on commit c62bc32

Please sign in to comment.