httpipe icon indicating copy to clipboard operation
httpipe copied to clipboard

Add HTTPipe.Conn.to_curl/1

Open andrewvy opened this issue 8 years ago • 0 comments

🎉 hey! I talked about this before, and finally had some time to come up with a quick POC.

This adds a new module called HTTPipe.CurlHelpers which converts a %HTTPipe.Request{} into a curl string that can then be executed into the command-line.

  • HTTPipe.Conn.to_curl(request)
  • HTTPipe.Request.to_curl(request)
  • HTTPipe.CurlHelpers.convert_request_to_curl(request)

Not sure if this belongs here or not, so totally up to your discretion. This should cover the basics. (headers/params/body/form). (HTTPipe doesn't support multipart yet 😉 )

I also think there's a better way w/ using OptionParser.to_argv/2 here.

image

Unfortunately, I'm not sure what to do with the string escaping for the curl command. That makes it a bit harder to just copy/paste into your terminal.

andrewvy avatar Feb 24 '17 01:02 andrewvy