RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

[ANN] httpx 1.0.0 released

httpx 1.0.0 has been released.

HTTPX.get("https://gitlab.com/honeyryderchuck/httpx")

HTTPX is an HTTP client library for the Ruby programming language.

Among its features, it supports:

  • HTTP/2 and HTTP/1.x protocol versions
  • Concurrent requests by default
  • Simple and chainable API
  • Proxy Support (HTTP(S), CONNECT tunnel, Socks4/4a/5)
  • Simple Timeout System
  • Lightweight by default (require what you need)

And also:

  • Compression (gzip, deflate, brotli)
  • Streaming Requests
  • Authentication (Basic Auth, Digest Auth, AWS Sigv4)
  • Expect 100-continue
  • Multipart Requests
  • Cookies
  • HTTP/2 Server Push
  • H2C Upgrade
  • Automatic follow redirects
  • International Domain Names
  • GRPC
  • Circuit breaker
  • WebDAV
  • Datadog integration
  • Faraday integration
  • Webmock integration
  • Sentry integration

Here are the updates since the last release:

1.0.0 Breaking changes
  • the minimum supported ruby version is 2.7.0 .
  • The fallback support for IDNA 2003 has been removed. If you require this feature, install the idnx gem, which httpx automatically integrates with when available (and supports IDNA 2008).
  • :total_timeout option has been removed (no session-wide timeout supported, use :request_timeout).
  • :read_timeout and :write_timeout are now set to 60 seconds by default, and preferred over :operation_timeout;
    • the exception being in the :stream plugin, as the response is theoretically endless (so :read_timeout is unset).
  • The :multipart plugin is removed, as its functionality and API are now loaded by default (no API changes).
  • The :compression plugin is removed, as its functionality and API are now loaded by default (no API changes).
    • :compression_threshold_size was removed (formats in "content-encoding" request header will always encode the request body).
    • the new :compress_request_body and :decompress_response_body can be set to false to (respectively) disable compression of passed input body, or decompression of the response body.
  • :retries plugin: the :retry_on condition will not replace default retriable error checks, it will now instead be triggered only if no retryable error has been found.
plugins
  • :authentication plugin becomes :auth.
    • .authentication helper becomes .authorization.
  • :basic_authentication plugin becomes :basic_auth.
    • :basic_authentication helper is removed.
  • :digest_authentication plugin becomes :digest_auth.
    • :digest_authentication helper is removed.
  • :ntlm_authentication plugin becomes :ntlm_auth.
    • :ntlm_authentication helper is removed.
  • OAuth plugin: :oauth_authentication helper is rename to :oauth_auth.
  • :compression/brotli plugin becomes :brotli.
Support removed for deprecated APIs
  • The deprecated HTTPX::Client constant lookup has been removed (use HTTPX::Session instead).
  • The deprecated HTTPX.timeout({...}) function has been removed (use HTTPX.with(timeout: {...}) instead).
  • The deprecated HTTPX.headers({...}) function has been removed (use HTTPX.with(headers: {...}) instead).
  • The deprecated HTTPX.plugins(...) function has been removed (use HTTPX.plugin(...).plugin(...)... instead).
  • The deprecated :transport_options option, which was only valid for UNIX connections, has been removed (use :addresses instead).
  • The deprecated def_option(...) function, previously used to define additional options in plugins, has been removed (use def option_$new_option) instead).
  • The deprecated :loop_timeout timeout option has been removed.
  • :stream plugin: the deprecated HTTPX::InstanceMethods::StreamResponse has been removed (use HTTPX::StreamResponse instead).
  • The deprecated usage of symbols to indicate HTTP verbs (i.e. HTTPX.request(:get, ...) or HTTPX.build_request(:get, ...)) is not supported anymore (use the upcase string always, i.e. HTTPX.request("GET", ...) or HTTPX.build_request("GET", ...), instead).
  • The deprecated HTTPX::ErrorResponse#status method has been removed (use HTTPX::ErrorResponse#error instead).
dependencies
  • http-2-next minimum supported version is 1.0.0.
  • :datadog adapter only supports ddtrace gem 1.x or higher.
  • :faraday adapter only supports faraday gem 1.x or higher.
Improvements
  • circuit_breaker: the drip rate of real request during the “half-open” stage of a circuit will reliably distribute real requests (as per the drip rate) over the max_attempts, before the circuit is closed.
Bugfixes
  • Tempfiles are now correctly identified as file inputs for multipart requests.
  • fixed proxy plugin behaviour when loaded with the follow_redirects plugin and processing a 305 response (request needs to be retried on a different proxy).
Chore
  • :grpc plugin: connection won’t buffer requests before HTTP/2 handshake is commpleted, i.e. works the same as plain httpx HTTP/2 connection establishment.
    • if you are relying on this, you can keep the old behavior this way: HTTPX.plugin(:grpc, http2_settings: { wait_for_handshake: false }).

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in