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

Create a Hurl Entry from a Curl? #316

Closed
jcamiel opened this issue Oct 22, 2021 Discussed in #278 · 9 comments · Fixed by #1480
Closed

Create a Hurl Entry from a Curl? #316

jcamiel opened this issue Oct 22, 2021 Discussed in #278 · 9 comments · Fixed by #1480
Labels
enhancement New feature or request
Milestone

Comments

@jcamiel
Copy link
Collaborator

jcamiel commented Oct 22, 2021

(Imported from original discussion @leeola)

To rapidly create tests it would be helpful to be able to create Hurl Entries from a Curl command directly. Eg allowing a workflow of going through a browser application and copying the API requests via Copy as cURL and importing that directly into Hurl.

Is that possible now?

@fabricereix
Copy link
Collaborator

That would be very useful, indeed.
For a first step, we could provide Python scripts to make that conversion between curl commands and Hurl.

There is also the conversion between HAR and Hurl.

@zorohu
Copy link

zorohu commented Mar 5, 2023

@fabricereix Is there any progress in this function now? I also think this function can make curl users better use it

@fabricereix
Copy link
Collaborator

not really
I'll try to start a script in the next few days

@fabricereix
Copy link
Collaborator

We could add this convertion in hurlfmt.

Currently, hurlfmt takes only an Hurl input
and the output format is specified with --format text(default), json or html

We could also specify the input format.

for example

cat sample.curl | hurlfmt --in curl --out hurl   > sample.hurl

--in   Specify input format hurl (default), curl or har
--out  Specify output format hurl (default), json or html

The --format option will therefore be replaced by --out.
We could even add more combinations in the future, for example, for Hurl to curl.

@zorohu
Copy link

zorohu commented Mar 10, 2023

We could add this convertion in hurlfmt.

Currently, hurlfmt takes only an Hurl input and the output format is specified with --format text(default), json or html

We could also specify the input format.

for example

cat sample.curl | hurlfmt --in curl --out hurl   > sample.hurl

--in   Specify input format hurl (default), curl or har
--out  Specify output format hurl (default), json or html

The --format option will therefore be replaced by --out. We could even add more combinations in the future, for example, for Hurl to curl.

Thank you very much I personally look forward to this feature

@fabricereix fabricereix linked a pull request Apr 25, 2023 that will close this issue
@fabricereix
Copy link
Collaborator

Hi @zorohu,
the option --in curl has been added in hurlfmt in master.
It's still beta, it supports only a few curl options.
I would be interested to get your feedback before releasing a new version.

But you will need need rust installed and run cargo build.
hurlfmt is built by default in target/debug.

@jcamiel
Copy link
Collaborator Author

jcamiel commented Apr 28, 2023

Ping @leeola (original discussion creator)

@jcamiel jcamiel added this to the 3.0.0 milestone May 3, 2023
@jcamiel jcamiel closed this as completed May 3, 2023
@jcamiel jcamiel added the enhancement New feature or request label May 3, 2023
@meleu-cw
Copy link

Sorry about the ping, but it's just to make you guys feel the love! ❤️

This is freaking useful! ❤️

@bolanosdev
Copy link

nice post by @meleu-cw, i was able to convert my curl to hurl with his little snippet.
https://meleu.dev/til/hurl-convert-curl-request-to-hurl-code/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants