gencurl icon indicating copy to clipboard operation
gencurl copied to clipboard

Not generating from multipart/form-data curl

Open ViliNeto opened this issue 5 years ago • 2 comments

Hi, today I tried testing for multipart/form-data cURL posting, but it didn't convert the form itself Original curl

curl -X POST \
  https://localhost:8000/login \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \

  -F button=ok

Converted to Golang

// Generated by curl-to-Go: https://mholt.github.io/curl-to-go

req, err := http.NewRequest("POST", "https://localhost:8000/login", nil)
if err != nil {
	// handle err
}
req.Header.Set("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW")

resp, err := http.DefaultClient.Do(req)
if err != nil {
	// handle err
}
defer resp.Body.Close()

ViliNeto avatar Jan 13 '19 20:01 ViliNeto

Nice find. PRs welcome. I'm slammed at work and this is a side project (and second on my list of improvements to side projects). I'm not sure I'll get to it anytime soon, but I can review PRs for sure. Thanks for the report!

sethgrid avatar Jan 14 '19 17:01 sethgrid

No problem my friend. I will try to help the project with this improvement. Great project, though.

ViliNeto avatar Jan 14 '19 19:01 ViliNeto