On the manual page of http you can find the following
Output options:
--print WHAT, -p WHAT
String specifying what the output should contain:
'H' request headers 'B' request body 'h' response headers 'b' response body
The default behaviour is 'hb' (i.e., the response headers and body is
printed), if standard output is not redirected. If the output is piped
to another program or to a file, then only the response body is printed by
default.
Which indicates that http intentionally behaves differently whenever the output is redirected. To obtain the same behavior as for not redirected output you can use
`http --print hb google.com > out.txt`
(But also note that pretty-printing behaves differently with redirection.)
0
Frerich Raabe
On
Use sys.stdout.isatty to tell whether stdout is a terminal (a "tty") or a file and print different output depending on that, e.g.:
On the manual page of
http
you can find the followingWhich indicates that
http
intentionally behaves differently whenever the output is redirected. To obtain the same behavior as for not redirected output you can use(But also note that pretty-printing behaves differently with redirection.)