Open
Conversation
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)`
Adds a new section for "Curl String" in the Request's inspect algebra doc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎉 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.CurlHelperswhich 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.
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.