Sending a request with -F/file fields (multipart content type) produces a body that servers reject with:
no multipart boundary param in Content-Type
Two issues in the multipart branch of SubmitRequest:
-
The Content-Type header is sent as the literal string multipart/form-data with no boundary parameter (config.ContentTypes maps multipart to multipart/form-data). Servers cannot parse a multipart body without the boundary.
-
multiWriter.Close() is deferred, so it runs only after the body buffer has already been captured via bytes.NewReader(bodyBytes.Bytes()) and sent. The terminating boundary is never written, so the body is also truncated.
Result: every multipart upload body is rejected and incomplete.
Sending a request with
-F/file fields (multipart content type) produces a body that servers reject with:Two issues in the multipart branch of
SubmitRequest:The
Content-Typeheader is sent as the literal stringmultipart/form-datawith noboundaryparameter (config.ContentTypesmapsmultiparttomultipart/form-data). Servers cannot parse a multipart body without the boundary.multiWriter.Close()is deferred, so it runs only after the body buffer has already been captured viabytes.NewReader(bodyBytes.Bytes())and sent. The terminating boundary is never written, so the body is also truncated.Result: every multipart upload body is rejected and incomplete.