-
Notifications
You must be signed in to change notification settings - Fork 487
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 hurlfmt --out=curl option #2666
Comments
Hi @hunter-gatherer8, |
@fabricereix as it's a rather recurring question/issue, maybe we can introduce a $ hurl --curl commands.txt --test *.hurl curl has a We could use |
@hunter-gatherer8 if you're OK, we're changing the title of the issue to "Add --curl option" |
@jcamiel surely you know better how to approach this, but I formulated it this way consciously, for several reasons:
So, in all honesty, all of this is tangential to While I somehow didn't manage to find #2615 on my own, I already acknowledged in the description, that handling templating/dynamic variables in All of this being said, surely just being able to capture |
Thanks @hunter-gatherer8 thanks for the feedback! Regarding conversion, we've introduced, since the first versions of Hurl, the possibility to convert a Hurl file to a JSON representation ( I still like to have an option |
Problem to solve
While
hurl
is very handy to play with unfamiliar APIs and even to store API request collections, it isn't very interoperable with anything else, and in the end you'd often want to "copy" the request to share with someone else or transform it into a code in some programming language to use in an actual project, which is usually very trivial, but tedious, since it's often just re-typing all theQueryStringParams
in a slightly different format.While there are dozens of possible desired output formats,
curl
CLI can be considered a common denominator, and there are multiple tools to convertcurl
command into different programming languages, as well as import them into similar tools like Postman/Bruno. So while in a perfect worldhurlfmt
could serve as a converter between all sorts of formats, really just being able to output a chain ofcurl
commands covers a lot of ground.Proposal
Add
hurlfmt --out=curl
option.hurlfmt
already can convertcurl
tohurl
(#316), but, surprisingly, there currently is no option to do it other way around.If there is a chain of requests, produce several
curl
commands. If templates are used inrequest.hurl
, I propose to leave variable names verbatim. Everything else (assertions, captures, etc) can be ignored.It would be really nice, if the converter could be very explicit and include the default
hurl
headers and such, even if not specified in the sourcerequest.hurl
file, since this can make a difference in the real world. But would be also useful without it, if it's complicated for some reason.The text was updated successfully, but these errors were encountered: