Skip to content

Add HTTPipe.Conn.to_curl/1#11

Open
andrewvy wants to merge 2 commits intoDavidAntaramian:masterfrom
andrewvy:master
Open

Add HTTPipe.Conn.to_curl/1#11
andrewvy wants to merge 2 commits intoDavidAntaramian:masterfrom
andrewvy:master

Conversation

@andrewvy
Copy link

@andrewvy andrewvy commented Feb 24, 2017

🎉 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.

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)`
@DavidAntaramian DavidAntaramian self-assigned this Feb 24, 2017
Adds a new section for "Curl String" in the Request's inspect algebra doc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants