How can I rewrite the following CURL command, so that it doesn't use the -F
option, but still generates the exact same HTTP request? i.e. so that it passes the multipart/form-data in the body directly.
curl -X POST -F example=test http://localhost:3000/test
Here's an alternative answer with the original CURL statement re-written using
-d
as a one-liner, without temporary files. Personally I think the temporary files approach is easier to understand, but I'm putting this here for reference as well:Notes: the
$'blar'
syntax is so that bash will parse the \r\n as a CRLF token. Thanks to this answer for that tip.