diff --git a/sdk/armcore/go.mod b/sdk/armcore/go.mod index 7adec215b8ea..e8d8be27cd05 100644 --- a/sdk/armcore/go.mod +++ b/sdk/armcore/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/armcore go 1.14 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.13.1 + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.13.3 github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.0 ) diff --git a/sdk/armcore/go.sum b/sdk/armcore/go.sum index b5996503702d..9fadc49ed287 100644 --- a/sdk/armcore/go.sum +++ b/sdk/armcore/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.13.1 h1:YLBIWApuKB/RS0dK/mk/2g6x2+kjI9djMKqViZDTD88= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.13.1/go.mod h1:pElNP+u99BvCZD+0jOlhI9OC/NB2IDTOTGZOZH0Qhq8= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.13.3 h1:Q/fMaKaJfKuwlQNELa2ttHS3zzn0KXf43HmrvAYRxMY= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.13.3/go.mod h1:pElNP+u99BvCZD+0jOlhI9OC/NB2IDTOTGZOZH0Qhq8= github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.0 h1:HG1ggl8L3ZkV/Ydanf7lKr5kkhhPGCpWdnr1J6v7cO4= github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.0/go.mod h1:k4KbFSunV/+0hOHL1vyFaPsiYQ1Vmvy1TBpmtvCDLZM= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/sdk/armcore/poller.go b/sdk/armcore/poller.go index e949a28ad45f..d3870314182a 100644 --- a/sdk/armcore/poller.go +++ b/sdk/armcore/poller.go @@ -6,10 +6,12 @@ package armcore import ( + "bytes" "context" "encoding/json" "errors" "fmt" + "io" "io/ioutil" "net/http" "net/url" @@ -452,6 +454,17 @@ func (pt *pollingTrackerBase) updateRawBody() error { pt.Err = err return pt.Err } + // seek back to the beginning of the body or reassign the information to the body + if seeker, ok := pt.resp.Body.(io.Seeker); ok { + _, err = seeker.Seek(0, io.SeekStart) + if err != nil { + pt.Err = err + return pt.Err + } + } else { + // put the body back so it's available to other callers + pt.resp.Body = ioutil.NopCloser(bytes.NewReader(b)) + } // observed in 204 responses over HTTP/2.0; the content length is -1 but body is empty if len(b) == 0 { return nil