3 ms·
> Like curl but unlike httpie, headers are written on stderr instead of stdout. What’s the thinking here? If I ask for the headers, wouldn’t I want that on std
by kjsthree 7y ago
> Like curl but unlike httpie, headers are written on stderr instead of stdout.
What’s the thinking here? If I ask for the headers, wouldn’t I want that on stdout?
- Arnavion 7y agoThe examples show that the headers are printed by default, so writing them to stderr is the correct behavior.
- kjsthree 7y agoWriting 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?
- unilynx 7y agoA 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..
- Arnavion 7y ago>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.
- poitrus 7y agoIt'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 ;)
- rochacon 7y agoIDK, 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
- poitrus 7y agoI get that sometimes too. It should be fixable without having to send headers to stdout.
- andreareina 7y agoMost 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.