hyper::Client
]This crate provides a mock [Connector
] to replace the default one when testing applications
that makes HTTP calls using [hyper
].
```rust
// Create a mock Connector let mut builder = Connector::builder(); builder .expect() .times(1) .with_uri("https://example.com/test") .returning("OK")?; let connector = builder.build();
// Use it when creating the hyper Client let client = hyper::Client::builder().build::<_, Body>(connector.clone());
// Send requests as normal let res = client .request( Request::builder() .uri("https://example.com/test") .body("".tostring().into())?, ) .await?;
// Check if all expectations were called the right number of times connector.checkpoint()?;
```