hurl icon indicating copy to clipboard operation
hurl copied to clipboard

Create a Hurl Entry from a Curl?

Open jcamiel opened this issue 3 years ago • 1 comments

(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?

jcamiel avatar Oct 22 '21 08:10 jcamiel

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.

fabricereix avatar Oct 23 '21 17:10 fabricereix

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

zorohu avatar Mar 05 '23 05:03 zorohu

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

fabricereix avatar Mar 06 '23 13:03 fabricereix

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.

fabricereix avatar Mar 10 '23 06:03 fabricereix

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

zorohu avatar Mar 10 '23 08:03 zorohu

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.

fabricereix avatar Apr 25 '23 07:04 fabricereix

Ping @leeola (original discussion creator)

jcamiel avatar Apr 28 '23 12:04 jcamiel