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.
This commit is contained in:
Shireesh Anjal
2021-11-16 08:37:08 -08:00
committed by GitHub
parent 3a4e469334
commit ff1e0f5371
+1 -1
View File
@@ -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 {