Recording your isahc calls
The only way currently to record isahc is to spawn a proxy and configure isahc to use this proxy. This is exactly what the following snippet does.
This requires the record-isahc
feature.
use asserhttp::*;
#[tokio::test(flavor = "multi_thread")] // 👈 required by recording proxy
#[stubr::mock("ping.json")] // 👈 spawn a mock server
async fn record_isahc() {
// 👇 spawn the recording proxy
stubr::Stubr::record() // or `record_with()` for configuring it
// 👇 builds an isahc client with proxy configured
.isahc_client()
.get(stubr.uri())
.expect_status_ok();
}
You can find your recorded stubs under ./target/stubs/localhost