rainier-http-client 2.0.0

An outbound HTTP client for the Rainier framework, with a fake for tests.
Documentation

rainier-http-client

The outbound HTTP client for the Rainier framework — a fluent Http:: facade, with a fake that makes an outbound call assertable.

let response = Http::post("https://hooks.example.com/user-updated")
    .json(&payload)?
    .timeout(Duration::from_secs(10))
    .retry(3, Backoff::exponential())
    .send()
    .await?;
Http::fake();

notify_application(&user).await?;

Http::assert_sent(|request| request.url_contains("/user-updated"));

Without the fake, asserting that an outbound call happened means standing up a real server in a test — so nobody does, and the code that signs the webhook is the code nothing exercises.

See the documentation.

Licence

MIT OR Apache-2.0.