HTTPX design goals are to be simple and intuitive to use, to not reinvent the wheel, and to be forwards-compatible with the protocols of tomorrow.

It was made in order to provide a ruby http test library that could support both HTTP/2 and HTTP/1 (and its unique features) using the same API. Beyond that, it tried to take the best features of existing ruby HTTP libraries, and avoiding its inconsistencies.

Basic Usage

  • Make Requests: learn how to make requests
  • Pass Parameters: learn how to send requests using query, form (“www-form-uriencoded”), raw data, and multipart files in requests
  • Response Handling: learn how to handle responses from requests


HTTPX ships with a plugin system “inherited” from sequel, roda or shrine. It allows for controlled extension of the core functionality, i.e. it can be plugged-in at the instance level.

require "httpx"

# sends request with the "Authentication" header
auth_client = HTTPX.plugin(:authentication)
auth_client.authentication("SECRET-TOKEN").get("") #=> ...Authentication: "SECRET-TOKEN"\r\n...

# does NOT send the "Authentication" header

  • Proxy: send requests through HTTP, HTTPS, Socks4, Socks4a, Socks5 or SSH proxies.
  • Authentication: authenticate requests using HTTP Basic Auth or HTTP Digest Auth.
  • Follow Redirects: requests which automatically follow HTTP 3XX Redirect responses.
  • Retries: retry requests on certain errors.
  • Cookies: manage Cookies in requests for the duration of a session.
  • Compression: handle compression and decompression of requests and responses (gzip, deflate, brotli).
  • Server Push: (HTTP/2 only) support server push, receive responses before initiating requests.
  • H2C Upgrade: (cleartext HTTP/1.1 only) upgrade an HTTP/1 connection to an HTTP/2 connection.
  • Multipart Uploads: send multipart/upload requests using a friendlier API.
  • Persistent: keep the connection pools alive, increases connection reuse.
  • Expect: Supports Expect: 100-continue header in requests with a body.
  • Rate Limiter: handle rate limiting responses from throttling server automatically;
  • Custom Plugins: learn how to create your custom plugin and extend the API.




If you want to contribute, here’s what you’ll need to know.

Ruby or docker

In order to contribute, you can choose to develop in your machine, or use the docker-compose setup we use for the CI builds.

If you choose to develop locally, you’ll have to have ruby installed. It’s recommended you use a ruby version manager for this. If you never worked with one, my personal recommendation is to use chruby and ruby-install. You’ll also need gcc (or clang) and make installed (some development dependencies require the installation of C-extensions). All test runs will hit publicly available peers (i.e.:

If you choose to develop using docker:

# this example is for ruby 2.7 specifically, there's a compose file for each supported version
> docker-compose -f docker-compose.yml -f docker-compose-ruby-2.7.yml run --entrypoint sh httpx
> test/support/ci/

and you’re good to go. All tests will run against the containerized services.


When writing tests, you have to focus on minimalism. If you look at the test suite, only one assertion method from minitest is being used in most cases: assert. There will be exceptions, but you’ll be asked to use assert whenever possible.

Integration test first

All HTTP features have an integration test using httpbin (with a few exceptions). If you want to add a specific HTTP feature, test it using an endpoint from httpbin which can validate it.