From d0c62eb584e57387fa62a8b6637b077aa3b2717d Mon Sep 17 00:00:00 2001 From: Shireesh Anjal <355479+anjalshireesh@users.noreply.github.com> Date: Tue, 16 Nov 2021 22:07:08 +0530 Subject: [PATCH] Fix health upload to subnet failing (#3870) The writer needs to be closed before creating the request. Otherwise the call to subnet api fails with error like: HTTP/1.x transport connection broken: http: ContentLength=6235 with Body length 6303. --- cmd/admin-subnet-health.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/admin-subnet-health.go b/cmd/admin-subnet-health.go index 3db70147..1d284f11 100644 --- a/cmd/admin-subnet-health.go +++ b/cmd/admin-subnet-health.go @@ -347,10 +347,10 @@ func subnetUploadReq(url string, filename string) (*http.Request, error) { if e != nil { return nil, e } - defer writer.Close() if _, e = io.Copy(part, file); e != nil { return nil, e } + writer.Close() r, e := http.NewRequest(http.MethodPost, url, &body) if e != nil {