Open bl-ue opened 3 years ago
@bl-ue I like your ideas. They add a nice human touch, which is an important principle behind httpie’s design.
To summarize, there’re two broader ideas here:
Cookie
& Set-Cookie
).Improving the syntax highlighting should be quite straightforward (please feel free to create a new issue for this).
Simply adding humanized versions of headers with data, though, would break backward-compatibility and also the current principle of not altering the message structure. So there’s some product design thinking on my part to be done here.
and also the current principle of not altering the message structure.
I wondered if there was something like that behind HTTPie. That's actually why I added two spaces before the parentheses, I know that's a great way to distinguish between the original text and the added text!
What would you do in that case? Add a --humanize
option that adds humanization with a warning/info in the help that the output will not be the exact output?
Techinically, with colors, the output is already completely athwart the original, because the ANSI escape codes used to output color are not included in the HTTP spec :smile: but I know, you mean visually.
Improving the syntax highlighting should be quite straightforward (please feel free to create a new issue for this).
You mean to discuss/advertise this change?
I wondered if there was something like that behind HTTPie. That's actually why I added two spaces before the parentheses, I know that's a great way to distinguish between the original text and the added text!
The idea is to make it easy for the user to copy the output and paste it, for example, into their API documentation. So although the spaces help visually, the extra output still breaks this use case.
What would you do in that case? Add a
--humanize
option that adds humanization with a warning/info in the help that the output will not be the exact output?
--format-options
(which I completely forgot about for a moment).--format-options headers.humanize:true
.--humanize
as a shortcut similar to --sorted
/ --unsorted
(which toggles both headers.sort:true
and json.sort_keys:true
).Techinically, with colors, the output is already completely athwart the original, because the ANSI escape codes used to output color are not included in the HTTP spec 😄 but I know, you mean visually.
You can still copy the output and paste it into your API documentation without any cleanup.
Improving the syntax highlighting should be quite straightforward (please feel free to create a new issue for this).
You mean to discuss/advertise this change?
The syntax highlighting improvement is a separate topic so it should have its own GitHub issue.
Hello!
I have some ideas for improving the display of headers in HTTPie. Please let me know which ones you agree with and I'll see if I can implement them right away.
If the value of any header matches the RFC 2616 allowed date formats, add a parenthetic, colored message at the end of the header stating how long ago/how long from now the date is, e.g.:
Color the values of the
Cookie
/Set-Cookie
headers because developers frequently inspect themAdd a colored, parenthetic, formatted version of the value of
Content-Length
headers:What do you think @jakubroztocil @Almad?