Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON pretty printing inserts extra newline #349

Open
eproxus opened this issue Jan 18, 2024 · 3 comments
Open

JSON pretty printing inserts extra newline #349

eproxus opened this issue Jan 18, 2024 · 3 comments

Comments

@eproxus
Copy link

eproxus commented Jan 18, 2024

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?)

@zuisong
Copy link
Contributor

zuisong commented Apr 9, 2024

This is intentional.
see #109

@eproxus eproxus closed this as completed Apr 9, 2024
@eproxus eproxus reopened this Apr 9, 2024
@eproxus
Copy link
Author

eproxus commented Apr 9, 2024

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).

@blyxxyz
Copy link
Collaborator

blyxxyz commented Apr 9, 2024

Related: httpie/cli#1547

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants