#http-request #exponential-backoff #middleware #request-response #client #response-body #logging

httpclient

HTTP client with middleware. Middleware provides composable support for record/replay, logging, exponential backoff, and more.

75 releases

new 0.23.21 Nov 21, 2024
0.23.18 Oct 17, 2024
0.23.10 Jul 14, 2024
0.21.3 Jan 22, 2024
0.1.12 Mar 31, 2022

#91 in HTTP client

Download history 445/week @ 2024-08-01 242/week @ 2024-08-08 150/week @ 2024-08-15 89/week @ 2024-08-22 139/week @ 2024-08-29 266/week @ 2024-09-05 498/week @ 2024-09-12 230/week @ 2024-09-19 269/week @ 2024-09-26 129/week @ 2024-10-03 451/week @ 2024-10-10 337/week @ 2024-10-17 34/week @ 2024-10-24 74/week @ 2024-10-31 77/week @ 2024-11-07 25/week @ 2024-11-14

223 downloads per month
Used in 30 crates (29 directly)

MIT license

95KB
2.5K SLoC

GitHub Contributors Stars Build Status Downloads Crates.io

HttpClient

httpclient is a user-friendly http client in Rust. Where possible, it closely mimics the reqwest API. Why build a new http client?

  • httpclient::{Request, Response} objects are serde-serializable, which enables record/replay functionality. See the example below to see it in action.
  • httpclient provides an API for user-extensible middleware. Built-in middleware includes redirect, retry, logging, and record/replay.
  • httpclient provides a built-in Error type that can return the Http request, which includes the status code, headers, and response body.
  • httpclient provides convenience methods that reqwest does not support. The most important is the IntoFuture implementation, which awaits both the request and the response body, which simplifies the scenario where you want to return the request body even in error cases.

Oauth2

For Oauth2, use Oauth2Flow and the Oauth2 middleware from httpclient_oauth2.

Roadmap

  • Hide secrets in Recorder. Hash & Eq checks for requests must respect hidden values.
  • Ensure it builds on wasm32-unknown-unknown
  • Sanitize "sessid" in json

Dependencies

~6–18MB
~256K SLoC