httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
33.37k stars 3.67k forks source link

[suggestion] Friendly Content-Length representation #643

Closed mqudsi closed 6 years ago

mqudsi commented 6 years ago

I'm not sure how this would work in terms of making clear what was actually sent by the server and what has been marked up by httpie, but it would be nice to have a "friendly" representation of the content length in base two units so output along the lines of http --headers ... could be more easily understood at a glance.

jkbrzt commented 6 years ago

@mqudsi you can see a human-friendly representation of the download size calculated from Content-Length (if provided) with the download mode enabled (via --download / -d):

$ http --download https://raw.githubusercontent.com/jakubroztocil/httpie/master/httpie.png
HTTP/1.1 200 OK
Content-Length: 186489

Downloading 182.12 kB to "httpie.png"
Done. 182.12 kB in 0.07714s (2.31 MB/s)

The default mode is meant to show the raw headers.