ducaale / xh

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

Any option to show 103 Early Hints responses? #385

Open moon-musick opened 4 weeks ago

moon-musick commented 4 weeks ago

Is there any option to show an 103 Early Hints response?

It seems HTTPie stops at a 103 response and does not go further. I admit I haven't check the 3.2.3 version, still using 3.2.2, but release notes don't suggest any other behavior implemented in 3.2.3.

I found xh and it looks very promising, with its native HTTP 2 support and performance gains over HTTPie, and it's great it doesn't stop at a 103 response.

Is there an option to show the 103 being returned by the server? I tried various combinations of --verbose, --all, --follow, and --print options, to no avail.

My rationale is, I have been using HTTPie for a long time as a diagnostic tool, as I work as a sysadmin at a mid-size regional news site. Quickly checking whether some endpoint is working, if there are specific headers being set etc. is an important part of my job. I can often answer a question from an exec or a developer in mere seconds by issuing a specific HTTP request and sending them a readable screenshot as a proof helps a lot. It doesn't work like that with 103 Early Hints. I can check these with curl --verbose, but the messy output even after cleanup doesn't resemble pretty and readable HTTPie / xh output.

blyxxyz commented 4 weeks ago

We don't have an option for this right now. The library we use unfortunately doesn't support it: https://github.com/hyperium/hyper/issues/2565

Or rather, it only supports it as an unstable unsafe FFI API. The internal plumbing is there so adding it as a stable Rust feature might not be too much work. (Unless this plumbing only exists for HTTP/1 and not HTTP/2?)

On the xh side I think it would make sense to add it as another letter you can pass to --print. Not sure whether it should be enabled by default with --verbose.

Apparently HTTPie's behavior is a known issue that's also caused by library limitations: https://github.com/psf/requests/issues/5190

moon-musick commented 4 weeks ago

Thanks for checking this out. I suppose you'd need to wait for hyper to implement it as a stable feature? I can't help with that unfortunately, I know some Rust, but most definitely not enough yet.

As for the xh CLI interface, I certainly don't mind having it hidden behind an additional option, as long as it's there :)