xh
xh copied to clipboard
JSON pretty printing inserts extra newline
Compare:
$ xh get https://jsonplaceholder.typicode.com/todos/1
HTTP/2.0 200 OK
...headers...
{
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
}
$
With:
$ xh get google.com
HTTP/1.1 301 Moved Permanently
...headers...
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
$
(Maybe the last newline should be stripped in the HTML case too?)
This is intentional. see #109
Is it really needed at the end of the output? It feels like it just wastes space in the terminal... 🙂 (I can see the need between bodies/chunks, but not at the end of the output).
Related: https://github.com/httpie/cli/issues/1547