Always close response body in uploads
This commit is contained in:
parent
a4639eb668
commit
bf277e197f
1 changed files with 2 additions and 2 deletions
|
@ -154,14 +154,13 @@ func (c *Client) FinalizeUploadMedia(upload *StartGoogleUpload) (*MediaUpload, e
|
||||||
if resErr != nil {
|
if resErr != nil {
|
||||||
panic(resErr)
|
panic(resErr)
|
||||||
}
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
|
|
||||||
statusCode := res.StatusCode
|
statusCode := res.StatusCode
|
||||||
if statusCode != 200 {
|
if statusCode != 200 {
|
||||||
return nil, errFinalizeUploadMedia
|
return nil, errFinalizeUploadMedia
|
||||||
}
|
}
|
||||||
|
|
||||||
defer res.Body.Close()
|
|
||||||
|
|
||||||
rHeaders := res.Header
|
rHeaders := res.Header
|
||||||
googleResponse, err3 := io.ReadAll(base64.NewDecoder(base64.StdEncoding, res.Body))
|
googleResponse, err3 := io.ReadAll(base64.NewDecoder(base64.StdEncoding, res.Body))
|
||||||
if err3 != nil {
|
if err3 != nil {
|
||||||
|
@ -202,6 +201,7 @@ func (c *Client) StartUploadMedia(encryptedImageBytes []byte, mime string) (*Sta
|
||||||
if resErr != nil {
|
if resErr != nil {
|
||||||
panic(resErr)
|
panic(resErr)
|
||||||
}
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
|
|
||||||
statusCode := res.StatusCode
|
statusCode := res.StatusCode
|
||||||
if statusCode != 200 {
|
if statusCode != 200 {
|
||||||
|
|
Loading…
Reference in a new issue