ducaale / xh

Friendly and fast tool for sending HTTP requests
MIT License
5.58k stars 99 forks source link

Support silencing warnings via double `-q` flag #179

Closed ducaale closed 4 months ago

ducaale commented 3 years ago

See https://github.com/httpie/httpie/issues/1100 and https://github.com/httpie/httpie/pull/1175

Abdiramen commented 3 years ago

I'm considering implementing this feature but it seems that xh already silences warnings.

   ~ ─────────────────────────────────────────────────────────────────────────────── 19:22:57 
❯ http --check-status --quiet pie.dev/status/500

http: warning: HTTP 500 Internal Server Error

   ~ ─────────────────────────────────────────────────────────────────────────────── 19:23:09 
❯ xh --check-status --quiet pie.dev/status/500
   ~ ─────────────────────────────────────────────────────────────────────────────── 19:23:18 
❯

Should this be changed along with the addition of -qq?

ducaale commented 3 years ago

Should this be changed along with the addition of -qq?

Yes, please. Unlike HTTPie, we aren't currently outputting HTTP warnings if the --quite or --output flag is being used.

xh

$ xh --check-status --quiet pie.dev/status/500
$ xh --check-status --output /dev/null pie.dev/status/500
$ xh --check-status pie.dev/status/500 > /dev/null
xh: warning: HTTP 500 Internal Server Error

HTTPie

$ http --check-status --quiet pie.dev/status/500

http: warning: HTTP 500 Internal Server Error

$ http --check-status --output /dev/null pie.dev/status/500

http: warning: HTTP 500 Internal Server Error

$ http --check-status pie.dev/status/500 > /dev/null

http: warning: HTTP 500 Internal Server Error

This can be fixed by:

  1. Modifying this line to take args.quite into account.
  2. Checking if we're not outputting into the terminal instead of checking if we have a redirected output.
farmeroy commented 1 year ago

Is this issue still open?