Hacker News new | ask | show | jobs
by orf 3082 days ago
Curl is alright, and congratulations on this massive and very impressive step forwards, but the CLI not exactly very user friendly. httpie[1] is a great tool if you find curl invocation somewhat arcane.

1. https://httpie.org/

6 comments

That seems like a tool designed for a very specific use-case (JSON APIs), rather than the general-purpose protocol interaction of cURL. The fact that it appears to be doing some things "behind your back" to be "helpful" like reordering headers or otherwise manipulating the data would certainly be unwanted in a general-purpose tool.
True. But for those of us who work with JSON APIs more-often-than-not it's very good. Being able to simply pipe in a file as a payload saves me a lot of time.

I know cURL does 1001 other things too, so the two tools aren't really in competition. HTTPie is more akin to Postman or Insomnia.

Use the "jq" command line tool to format json output. It's a life changer.

curl 'https://raw.githubusercontent.com/LearnWebCode/json-example/... | jq '.'

HTTPie is great, but sometimes you need curl. Curl supports a lot more protocols.
Plus, it's easy to forget that httpie is SLOW. Sometimes when testing an API the timings are worrying, until you remember and switch over to cURL to confirm everything is right with the world.
I don't know why you are getting downvoted. That's true, starting a Python interpreter is a relatively expensive operation. There is a noticeable lag with most CLIs written in Python.

There has been some work recently to make the interpreter start faster. I hope we will see the result in Python 3.7.

Yes, but MS seems to disable many of them.
curl is much more than http.
Well, I am not sure if I would call it arcane. There are only two things which I find a little non user friendly:

1. By default curl doesn't follow redirects and I think most use-cases (not all) require that behavior (at least from the cli).

2. Similar to wget, many users who start using curl do it to download something, probably a file. But opposite to wget curl doesn't write a file but to stdout. Actually, I find curls behavior much more UNIX style, but it is probably the first obstacle every user has to tackle. Nevertheless, in the end this makes curl easier to use, because you do not have to remember which parameter is used to set the output file name, but instead just use the universal unix operator '>'.

curl may not have the greatest CLI, but it's a huge step up from doing the equivalent tasks with powershell.

not to mention this brings windows closer and closer to nix. windows making itself more familiar to nix increases the number of ops folks that are willing to transition from nix shops to windows, increasing windows share in the server market

plus, as others have pointed out, curl handles protocols besides http.

Yea but can you export a httpie command from the browser?
No, and that's a real shame :(