X Tutup
Skip to content

Commit 40da8f9

Browse files
committed
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. https://github.com/golang/net/blob/d523dce5a7f4b994f7ed0531dbe44cd8fd803e26/http2/transport.go#L554
1 parent 8480381 commit 40da8f9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pkg/cmd/release/shared/upload.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ func uploadAsset(httpClient *http.Client, uploadURL string, asset AssetForUpload
170170
}
171171
req.ContentLength = asset.Size
172172
req.Header.Set("Content-Type", asset.MIMEType)
173+
req.GetBody = asset.Open
173174

174175
resp, err := httpClient.Do(req)
175176
if err != nil {

0 commit comments

Comments
 (0)
X Tutup