Re:HTTPie – A user-friendly CLI HTTP client
by andreareina on Sunday December 01, 2019 @03:17PM
(#21677558)
Most of the time when I do any further processing (save to file, pipe to other tools, etc) I'm interested in the response body. The headers are a useful diagnostic, and things like cookies are useful to save, but those don't typically belong in the same stream: I can't do the same things to the headers as I can the body, and so including both in the same stream will tend to reduce my options for downstream processing. If I actually do want them both in the same stream I can redirect stderr to stdout.
Re:HTTPie – A user-friendly CLI HTTP client
by rochacon on Sunday December 01, 2019 @01:42PM
(#21677042)
IDK, that is one of the things that annoys me to be honest, because sometimes headers get written after the body into the output (idk why, but guess some buffering and/or parsing+formating lag).
I almost forked it to get both outputs into stdout haha
Re:HTTPie – A user-friendly CLI HTTP client
by poitrus on Monday December 02, 2019 @02:32PM
(#21685934)
I get that sometimes too. It should be fixable without having to send headers to stdout.
Re:HTTPie – A user-friendly CLI HTTP client
by Arnavion on Sunday December 01, 2019 @01:41PM
(#21677038)
The examples show that the headers are printed by default, so writing them to stderr is the correct behavior.
Re:HTTPie – A user-friendly CLI HTTP client
by kjsthree on Sunday December 01, 2019 @02:11PM
(#21677218)
Writing by default is logically followed by stderr? I just don’t follow.
Asking a program for info and then getting that info on stderr seems really bizarre to me.
Is this some historical UNIXism?
Re:HTTPie – A user-friendly CLI HTTP client
by unilynx on Sunday December 01, 2019 @02:50PM
(#21677434)
A lot of command line tools send debugging output to stderr so you can build a pipe/redirect output and still see the debug and error outputs.
You could consider headers to be some sort of debug prints..
Re:HTTPie – A user-friendly CLI HTTP client
by poitrus on Monday December 02, 2019 @02:42PM
(#21686038)
It's convenient to have stdout only returning the body so you can work with it without having to remove the header. With curl, if you pass the -v, you get headers on stderr too.
When headers are specifically requests with -i for instance, I agree curlie should print them on stdout. PR accepted ;)
Re:HTTPie – A user-friendly CLI HTTP client
by Arnavion on Sunday December 01, 2019 @04:06PM
(#21677782)
>Asking a program for info and then getting that info on stderr seems really bizarre to me.
The info that you're asking the program for is the response body. You're using `curl` / `curlie` primarily to get the response body and then pipe it to the rest of the command. The headers are ancillary.
If the headers were the info you were asking for, eg when running `curl -D -`, then yes they should get printed to stdout. That is not the case being considered here.
What’s the thinking here? If I ask for the headers, wouldn’t I want that on stdout?