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=allApply both colors and formatting.Default for terminal output.
—pretty=colorsApply colors.
—pretty=formatApply formatting.
—pretty=noneDisables 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,

  1. $ http example.org/Movie.mov

You will nearly instantly see something like this:

  1. HTTP/1.1 200 OK
  2. Accept-Ranges: bytes
  3. Content-Encoding: gzip
  4. Content-Type: video/quicktime
  5. Transfer-Encoding: chunked
  6.  
  7. +-----------------------------------------+
  8. | NOTE: binary data not shown in terminal |
  9. +-----------------------------------------+