getParsedResponse return resp if getResponse return error (#428)

getParsedResponse return resp if getResponse return error

Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/go-sdk/pulls/428
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: John Olheiser <john.olheiser@gmail.com>
This commit is contained in:
6543 2020-09-29 14:19:31 +00:00 committed by John Olheiser
parent 779e9330e9
commit 3226ac2e53

View file

@ -237,7 +237,7 @@ func (c *Client) getResponse(method, path string, header http.Header, body io.Re
func (c *Client) getParsedResponse(method, path string, header http.Header, body io.Reader, obj interface{}) (*Response, error) {
data, resp, err := c.getResponse(method, path, header, body)
if err != nil {
return nil, err
return resp, err
}
return resp, json.Unmarshal(data, obj)
}