refactor: return full HTTP response for binary response bodies (#112)

This commit is contained in:
Daniel Moran
2021-06-10 11:20:33 -04:00
committed by GitHub
parent 1c2f61f5ca
commit a387cabcfb
23 changed files with 518 additions and 512 deletions

View File

@ -11,7 +11,6 @@
package api
import (
_gzip "compress/gzip"
_context "context"
_io "io"
_ioutil "io/ioutil"
@ -203,17 +202,12 @@ func (a *DeleteApiService) PostDeleteExecute(r ApiPostDeleteRequest) error {
return err
}
var body _io.ReadCloser = localVarHTTPResponse.Body
if localVarHTTPResponse.Header.Get("Content-Encoding") == "gzip" {
gzr, err := _gzip.NewReader(body)
if localVarHTTPResponse.StatusCode >= 300 {
body, err := GunzipIfNeeded(localVarHTTPResponse)
if err != nil {
body.Close()
return err
}
body = &deleteApiGzipReadCloser{underlying: body, gzip: gzr}
}
if localVarHTTPResponse.StatusCode >= 300 {
localVarBody, err := _ioutil.ReadAll(body)
body.Close()
if err != nil {