Skip to main content

One post tagged with "useful"

View All Tags

Elegant HTTP CLI, HTTPie

· 2 min read
Haril Song
Owner, Software Engineer at 42dot

Overview

CLI tool that can replace the curl command

If you are a developer who frequently uses Linux, you probably use the curl command often. It is an essential command for sending external API requests from a server, but it has the disadvantage of poor readability in the output. HTTPie is an interesting tool that can alleviate this drawback, so let's introduce it.

Install

For Mac users, you can easily install it using brew.

brew install httpie

For CentOS, you can install it using yum.

yum install epel-release
yum install httpie

Usage

First, here is how you would send a GET request using curl.

curl https://httpie.io/hello

curl-get

Now, let's compare it with HTTPie.

https httpie.io/hello

get

The readability is much better in every aspect of the command. The response and header values are included by default, so you can get various information at a glance without using separate commands.

Note that https and http are distinguished in the command.

http localhost:8080

You can send a POST request as described on the official website.

http -a USERNAME POST https://api.github.com/repos/httpie/httpie/issues/83/comments body='HTTPie is awesome! :heart:'

Various other features are explained on GitHub, so if you make good use of them, you can greatly improve productivity.

Reference