Update Azure Go SDK to v19.0.0

This commit is contained in:
Pengfei Ni
2018-07-24 17:00:27 +08:00
parent 5bf3b2119b
commit af1875fca6
103 changed files with 9156 additions and 8645 deletions

View File

@@ -187,7 +187,7 @@ func (f *File) Delete(options *FileRequestOptions) error {
func (f *File) DeleteIfExists(options *FileRequestOptions) (bool, error) {
resp, err := f.fsc.deleteResourceNoClose(f.buildPath(), resourceFile, options)
if resp != nil {
defer readAndCloseBody(resp.Body)
defer drainRespBody(resp)
if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound {
return resp.StatusCode == http.StatusAccepted, nil
}
@@ -212,7 +212,7 @@ func (f *File) DownloadToStream(options *FileRequestOptions) (io.ReadCloser, err
}
if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
readAndCloseBody(resp.Body)
drainRespBody(resp)
return nil, err
}
return resp.Body, nil
@@ -242,7 +242,7 @@ func (f *File) DownloadRangeToStream(fileRange FileRange, options *GetFileOption
}
if err = checkRespCode(resp, []int{http.StatusOK, http.StatusPartialContent}); err != nil {
readAndCloseBody(resp.Body)
drainRespBody(resp)
return fs, err
}
@@ -375,7 +375,7 @@ func (f *File) modifyRange(bytes io.Reader, fileRange FileRange, timeout *uint,
if err != nil {
return nil, err
}
defer readAndCloseBody(resp.Body)
defer drainRespBody(resp)
return resp.Header, checkRespCode(resp, []int{http.StatusCreated})
}