Allow retrying HTTP/2 uploads for release assets

The `Request.GetBody` func allows the retry mechanism to reopen the file
that's being uploaded as the request body in case the body of the
previous request has already started to be read.

Hopefully fixes the error:

    http2: Transport: cannot retry err [stream error: stream ID 1; REFUSED_STREAM]
    after Request.Body was written; define Request.GetBody to avoid this error

Ref. d523dce5a7/http2/transport.go (L554)
This commit is contained in:
Mislav Marohnić 2021-03-17 15:55:22 +01:00
parent 8480381d13
commit 40da8f9c69

View file

@ -170,6 +170,7 @@ func uploadAsset(httpClient *http.Client, uploadURL string, asset AssetForUpload
}
req.ContentLength = asset.Size
req.Header.Set("Content-Type", asset.MIMEType)
req.GetBody = asset.Open
resp, err := httpClient.Do(req)
if err != nil {