Terminal output
HTTPie does several things by default in order to make its terminal outputeasy to read.
Colors and formatting
Syntax highlighting is applied to HTTP headers and bodies (where it makessense). You can choose your preferred color scheme via the —style
optionif you don't like the default one (see $ http —help
for the possiblevalues).
Also, the following formatting is applied:
- HTTP headers are sorted by name.
- JSON data is indented, sorted by keys, and unicode escapes are convertedto the characters they represent.
One of these options can be used to control output processing:
—pretty=all | Apply both colors and formatting.Default for terminal output. |
—pretty=colors | Apply colors. |
—pretty=format | Apply formatting. |
—pretty=none | Disables output processing.Default for redirected output. |
Binary data
Binary data is suppressed for terminal output, which makes it safe to performrequests to URLs that send back binary data. Binary data is suppressed also inredirected, but prettified output. The connection is closed as soon as we knowthat the response body is binary,
- $ http example.org/Movie.mov
You will nearly instantly see something like this:
- HTTP/1.1 200 OK
- Accept-Ranges: bytes
- Content-Encoding: gzip
- Content-Type: video/quicktime
- Transfer-Encoding: chunked
- +-----------------------------------------+
- | NOTE: binary data not shown in terminal |
- +-----------------------------------------+