It just wraps curl and adds some nicer options, cookie handling, oauth and colorizing to it. Same command line you are already used to but with some extras that simplify live and make it more enjoyable.
The GitHub page does a good job of highlighting all of the benefits HTTPie has if you're already familiar with cURL. But for me it's the design of the interface with syntax highlighting being the sugar on top.
Thanks for this recommendation. I still value tips on using cURL because it is practically ubiquitous which is helpful when you are logged into some random server, but HTTPie definitely has a very common sense usage and I think it will be very useful as a testing tool for my local machine.
Strongly agree. For Windows users like me, i recommend installing Python and Pip using Chocolatey Nuget and then doing a `pip install httpie` to avoid Windows Python dependency hell and still get httpie.
> If you only care about headers use the -I flag and the response body will be hidden
That is actually wrong. The -I flag set the request method to HEAD. So in some cases it will return different headers than a normal get request (and some servers don't implement HEAD responses at all).
> The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response.
and that
> The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request.
A better way to view only the header of a response is using the flags -o to redirect the body and -D to redirect the header of the response. When I want to print only the header to stdout I do
curl -o/dev/null -D- http://www.example.com
-I does not work with methods other than GET. This does the job.
So you can use -I with another method, but as soon as you add a body curl refuses. Went ahead and just took that scenario out of the post -- but your redirection snippet is great.
-i, --include
(HTTP) Include the HTTP-header in the output. The HTTP-header includes things like server-name, date of the document, HTTP-version and more...
-I, --head
(HTTP/FTP/FILE) Fetch the HTTP-header only! HTTP-servers feature the command HEAD which this uses to get nothing but the header of a document. When used on an FTP or FILE file, curl displays the file size and last modification time only.
If you're on windows and don't feel like using the commandline you can click around in Fiddler to achieve similar things. The help is much shorter
http://www.fiddler2.com/fiddler/help/composer.asp
> If you're on windows and don't feel like using the commandline
Just install gow ( https://github.com/bmatzelle/gow ) and you'll be able to run all of those examples as intended. The command line becomes very pleasant on Windows after that one little install. It's very lightweight and well designed.
The site does not work on the iPhone at all if you want to zoom in to read the text. If you start to touch and scroll the menu that was hidden away on the left decides to rear its ugly head and makes the site completely unreadable.
I'm pretty frustrated with sites that don't just have a basic two column layout. Is this a template theme? Otherwise why would you waste so much time on a left column that reflows and messes up the browser experience? Or better yet why not test this on an actual mobile browser?
I am not trying to harp on this site or the author specifically because there are certainly other offenders. This site though is quite annoying because once you finally think yougot that stupid menu out of the way, BOOM it pops right back an ruins the site again.
This is both a rant and a notice to the author since most people probably got too fed up to tell him about this problem.
Thanks for the heads up. Made a quick fix by taking out affix on the column. Tried to get this up pretty quickly with Bootstrap, need to spend some more time on it this weekend. Sorry for the annoyance.
Well, doesn't everyone do "their own" shared hosting? With ip4 getting more and more scarce, and before ip6 is viable, I'll definitely keep using named vhosts for stuff. Add in SNI, and it even works with SSL. Sort of.
I generally use wget myself. For basic HTTP debugging needs, I run ":%!wget -Sd http://www.example.com inside a new vim buffer. Then I can read the Varnish headers or whatever and figure out what's going on.
I ran into an issue where the SSL implementation was a bit dated, though, and didn't recognize how a GoDaddy cert implemented multiple hostnames -- but it turned out to follow the standard. wget was just lacking in its implementation and reporting an error when the cert was fine.
Good catch -- need to get that page up :) Built echo primarily to help me test wiretap so it hasn't gotten much documentation love. Will get that up this weekend.
I never learnt cURL, or for that matter missed many of command-line tools because of the laziness to read boring long man pages. This is a perfect example of how a man page should be. All the options explained one by one with simple examples! It took me hardly 5 minutes, now I feel confident in using cURL for my next use.
This is a great resource. We use curl for sample API calls in our docs (developers.box.com/docs) because it's ubiquitous, but we've come to learn over time that knowledge of how to use curl is not ubiquitous.
cURL is worth learning in my experience because it is bulletproof, ubiquitous, fast, highly-configurable, and comprehensive. No other option listed in here are all of those things, though they are all easier to use. But start talking about SOCKS5 proxies or FTPS and all of a sudden you have to start monkey patching your (pretty) tool or, you know, learning curl.
Seriously how often are you guys performing PUTs and DELETEs manually from the command line? `man` up and write a wrapper.
You know, sending email from the command line isn't quite trivial, if you want to send in anything other than ascii. Telnet[0] to port 25 can be a lot of fun (alternatively openssl s_client[1] -starttls smtp ...).
For anyone not already familiar with this I'd recommend having a look at heirloom mailx[2].
Note, you can of course also pipe stuff to "/usr/bin/sendmail -t", which I'm sure was the thing claudio was alluding to.
I'd be interested to know exactly what you mean (I usually don't really get sarcasm). It seems that you think this advice is useless, or that people never use the command line, or something, but I don't really know what.
Could you be more specific? I find it useful to understand different points of view.
From the guidelines: On-Topic: Anything that good hackers would find interesting.
My guess is that caludio believes that good hackers would not find this article interesting. I somewhat agree, as I feel that article adds little to what can already be found in the cURL man page. Having said that, I do think there is worth in having good examples, which this article certainly did.
It's a little disheartening to see this at the top of HN though.
Site is "Hacker News", not "How-tos for dummies", last time I checked. Do we really need this kind of stuff in home page? Hardly so. What about an article on how to create a three columns layout with CSS? Or how to edit a file using a text editor? Come on... how to use curl? Really?
Seeing that 200+ people upvoted, it would suggests that enough people found it useful.
I will admit that I am not familiar with curl and I found this helpful and enlightening. If you don't find it useful, then just move on. We come to HKN to learn about the other aspects that we are not familiar with. Just be mindful that not everyone have the same expertise.