From 40da8f9c6919de57624e5f7f08beb29c4ea48365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Wed, 17 Mar 2021 15:55:22 +0100 Subject: [PATCH] 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 --- pkg/cmd/release/shared/upload.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/cmd/release/shared/upload.go b/pkg/cmd/release/shared/upload.go index abd9d33fc..e2d68ac48 100644 --- a/pkg/cmd/release/shared/upload.go +++ b/pkg/cmd/release/shared/upload.go @@ -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 {