Skip to content

Commit efb548e

Browse files
pablo-ruthPablo RUTH
andauthored
fix: don't try to read/unmarshal response content when empty (scaleway#2361)
Co-authored-by: Pablo RUTH <[email protected]>
1 parent c784ebe commit efb548e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scw/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func (c *Client) do(req *ScalewayRequest, res interface{}) (sdkErr error) {
230230
return sdkErr
231231
}
232232

233-
if res != nil {
233+
if res != nil && httpResponse.ContentLength > 0 {
234234
contentType := httpResponse.Header.Get("Content-Type")
235235

236236
if strings.HasPrefix(contentType, "application/json") {

0 commit comments

Comments
 (0)