Closed whyynoot closed 1 year ago
request.MultipartForm()
is only for incoming requests, not for outgoing.
You will have to use multipart.NewWriter()
and add the fields to that. Then you can either use io.ReadAll
to read the body into a byte slice and use request.SetBody()
to set it as body or use request.SetBodyStream()
. Don't forget to call request.Header.SetMultipartFormBoundary()
with the return value of multipart.Writer.Boundary()
.
Hello, I have an http client and trying to figure out how do I set multipart form data
i tried smth like this but this doesnt works for me, can u please help me with that