Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTTPipe.Conn.to_curl/1 #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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