#http-request #exponential-backoff #middleware #client #request-response #logging #record-replay

httpclient

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

67 releases (21 breaking)

new 0.23.13 Sep 11, 2024
0.23.10 Jul 14, 2024
0.21.3 Jan 22, 2024
0.20.2 Dec 25, 2023
0.1.12 Mar 31, 2022

#69 in HTTP client

Download history 135/week @ 2024-05-24 282/week @ 2024-05-31 505/week @ 2024-06-07 652/week @ 2024-06-14 241/week @ 2024-06-21 868/week @ 2024-06-28 159/week @ 2024-07-05 377/week @ 2024-07-12 259/week @ 2024-07-19 560/week @ 2024-07-26 413/week @ 2024-08-02 262/week @ 2024-08-09 110/week @ 2024-08-16 88/week @ 2024-08-23 169/week @ 2024-08-30 188/week @ 2024-09-06

605 downloads per month
Used in 28 crates

MIT license

89KB
2K 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

~9–21MB
~373K SLoC