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

--verbose --headers vs. --headers --verbose #287

Closed silverwind closed 9 years ago

silverwind commented 9 years ago

--verbose --headers doesn't print the request headers, while --headers --verbose does. I think the ordering of arguments shouldn't matter in this case, and request headers should always be printed with --verbose.

jkbrzt commented 9 years ago

@silverwind It's slightly counterintuitive in this case, but it's an intended behaviour and it's documented here: https://github.com/jakubroztocil/httpie#output-options

--headers, -h, --body, -b, and --verbose, -v are just aliases for --print=<arg>. And when you repeat an argument (which you in fact do here because both --headers and --verbose are treated as --print=<arg>), then the value specified last wins:

  1. http --verbose --headers (what you specify)
  2. http --print=hbHB --print=h (what HTTPie sees)
  3. http --print=h (how it interprets)
silverwind commented 9 years ago

Thanks for the detailed explanation. Still strikes me as odd that --verbose actually makes it print less information (regardless of argument ordering).