gencurl
gencurl copied to clipboard
Not generating from multipart/form-data curl
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()
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!
No problem my friend. I will try to help the project with this improvement. Great project, though.