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

Do not return error in case of empty body #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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