HTTPie is a cURL-like tool for humans. This is a docker image that eases setup.
From the official readme:
HTTPie (pronounced aych-tee-tee-pie) is a command line HTTP client. Its goal is to make CLI interaction with web services as human-friendly as possible. It provides a simple http command that allows for sending arbitrary HTTP requests using a simple and natural syntax, and displays colorized responses. HTTPie can be used for testing, debugging, and generally interacting with HTTP servers.
This docker image is available as a trusted build on the docker index, so using it is as simple as running:
$ docker run clue/httpie
Running this command for the first time will download the image automatically. Further runs will be immediate, as the image will be cached locally.
To further ease running, it's recommended to set up a much shorter alias
so that you can easily execute it as just http
:
$ alias http='docker run -it --rm --net=host clue/httpie'
This will create a temporary alias. In order to make it persist reboots,
you can append this exact line to your ~/.bashrc
(or similar) like this:
$ alias http >> ~/.bashrc
Once installed, running HTTPie is as simple as invoking it like this:
From the official examples:
Hello World:
$ http httpie.org
Custom HTTP method and headers:
$ http PUT example.org X-API-Token:123 name=John
Submitting forms:
$ http -f POST example.org hello=World
Upload a file using redirected input:
$ http example.org < file.json
Download a file and save it via redirected output:
$ http example.org/file > file
You can supply any number of HTTPie arguments that will be passed through unmodified.
HTTPie has a fairly extensive documentation available. Also, you can use its included help output:
$ http --help