stream plugin adds functionality to handle long-lived stream responses, such as the Twitter Streaming API:
http = HTTPX.plugin(:stream) http.get(stream_api_endpoint, stream: true).each_line do |line| payload = JSON.parse(line) # do smth with this end
rate_limiter plugin adds functionality for automatically hooking into rate-limiting responses coming from the server, and waits-and-retries them according to what the server advertises.
HTTPX.plugin(:rate_limiter).get(rate_limited_api_endpoint) # => 429 Too Many Requests .... Retry-After: 3 # waits 3 seconds before retrying
This release is the first testing against and targeting Ruby 3 and some of the new features.
It ships with RBS signatures for all of the client-facing APIs. There’s non 100% typinng coverage yet, but I’m gradually (pun intended) working on it.
Requests where the domains are formed by non-ASCII characters, are now supported (if you’re using ruby 2.3 or more recent).
HTTPX.get("http://bücher.ch") # it works!
cookies plugin is now independent of 3rd-party gems. The motivation for this was that
http-cookie was dependent of both
unf gems, which are currently unusable in ruby 3, and haven’t received any update in the last 3 years.
The implementation is still compliant with RFC6265, and all of the features provided in earlier versions were ported, exceptwhen loading the cookie jar stored in a Netscape-format file or Mozilla sqlite database, which were not documented for
httpx anyway, and I considered too niche to backport. If you feel
httpx should support those, do let me know.
Some code from these gems, including the ruby punycode implementation, is now part of the source tree, along with its licenses and attribution mentions.
Several edge-case bugs have been fixed solely by the integration of RBS runtime type checking, including some bugs around closing a connection pool that can cause loops.
#reason were removed, as they didn’t provide much value. Consider calling
#raise_for_status or checking the API (
respond_to?(:error) are strategies for this).