As stated previously, HTTPX tries to hide the gory details of the multy-layer protocol handling. It therefore ships with a “debug” mode (with verbosity levels).

It inspects a lot of details of the internal state, such as connection state, HTTP headers/payload, HTTP/2 frames, all that might be considered relevant for internal debugging or even for bug reporting).

You can enable it either using the options (for localized debugging), or using environment variables (for global library usage debugging).


You can use the :debug option to enable debugging and set the debugging stream ($stderr by default, but can be anything that responds to #<<(String)) and :debug_level to set the verbosity level:

HTTPX.with(debug: STDERR, debug_level: 2).get("")

Environment Variable

You can use the HTTPX_DEBUG to set the level of debugging from outside your program. This is very useful for script-based debugging (you cannot reset the log stream however, it will default to standard error):

> HTTPX_DEBUG=1 bundle exec ruby my_debugging_script_with_httpx.rb

Next: JRuby/Truffleruby/Other Rubies