... | ... | @@ -11,7 +11,7 @@ It was made in order to provide a ruby http test library that could support both |
|
|
|
|
|
## Plugins
|
|
|
|
|
|
`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.
|
|
|
`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.
|
|
|
|
|
|
```ruby
|
|
|
require "httpx"
|
... | ... | @@ -26,16 +26,14 @@ HTTPX.get("http://example.come") |
|
|
```
|
|
|
|
|
|
* [Proxy](Proxy): send requests through HTTP, HTTPS, Socks4, Socks4a, Socks5 or SSH proxies.
|
|
|
* [Authentication](Authentication): authenticate requests using HTTP Basic Auth or HTTP Digest Auth.
|
|
|
* [Auth](Auth): authenticate requests using HTTP Basic Auth or HTTP Digest Auth.
|
|
|
* [Follow Redirects](Follow-Redirects): requests which automatically follow HTTP 3XX Redirect responses.
|
|
|
* [Retries](Retries): retry requests on certain errors.
|
|
|
* [Cookies](Cookies): manage Cookies in requests for the duration of a session.
|
|
|
* [Compression](Compression): handle compression and decompression of requests and responses (gzip, deflate, brotli).
|
|
|
* [Server Push](Server-Push): (HTTP/2 only) support server push, receive responses before initiating requests.
|
|
|
* [Upgrade](Connection-Upgrade): (HTTP/1.1 only) negotiate an HTTP/1 connection into a new protocol via the `Upgrade` header
|
|
|
* [H2C](Connection-Upgrade#h2c): upgrade connection to cleartext HTTP/2 via `h2c` negotiation.
|
|
|
* [H2](Connection-Upgrade#h2): upgrade connection to HTTP/2 via `h2` prior knowledge when ALPN negotiation can't be used.
|
|
|
* [Multipart](Multipart-Uploads): send multipart requests using a friendlier API.
|
|
|
* [H2](Connection-Upgrade#h2): upgrade connection to HTTP/2 via `h2` prior knowledge when ALPN negotiation can't be used.
|
|
|
* [Persistent](Persistent): keep the connection pools alive, increases connection reuse.
|
|
|
* [Stream](Stream): handles streaming requests (i.e. the [Twitter Streaming API](https://developer.twitter.com/en/docs/tutorials/consuming-streaming-data)).
|
|
|
* [Expect](Expect): Supports `Expect: 100-continue` header in requests with a body.
|
... | ... | @@ -59,6 +57,7 @@ HTTPX.get("http://example.come") |
|
|
|
|
|
## Considerations
|
|
|
|
|
|
* [Compression](Compression): handle compression and decompression of requests and responses (gzip, deflate, brotli).
|
|
|
* [Error Handling](Error-Handling): how `httpx` handles errors when using multiple requests.
|
|
|
* [Events and callbacks](Events): how to react on specific moments of an HTTP request lifecycle.
|
|
|
* [IDN](Internationalized Domain Names): how `httpx` handles IDNA.
|
... | ... | @@ -95,7 +94,7 @@ and you're good to go. All tests will run against the containerized services. |
|
|
|
|
|
### assert
|
|
|
|
|
|
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.
|
|
|
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
|
... | ... | |