Starts a Stubr mock server and creates a stubr
variable which can be used to call the server e.g. stubr.uri()
. It
supports both standard and async test functions.
```rust, no_run
use isahc; use asserhttp::*; // optional
fn simpletest() { isahc::get(stubr.uri()).expectstatus_ok(); } ```
Can also be used for recording with #[stubr::record]
. It will spawn a standalone proxy which will record all http
exchanges.
A recorder
variable is created so that you can interact with the proxy. You then need to configure your http client to
use this proxy. With record-isahc
or record-reqwest
features you can get an http client configured to hit the
recorder proxy. It supports both standard and async test functions.
```rust, no_run
use isahc; use asserhttp::*; // optional
fn simpletest() { recorder.isahcclient().get(stubr.uri()).expectstatusok(); // a recorded stub has been created under 'target/stubs' } ```
Starts a Stubr server for each remote app name supplied.
Those remote apps' stubs are imported by stubr-build and will help you test your app's
dependencies over other apps/microservices using http.
```rust, no_run
use isahc; use asserhttp::*; // optional
fn usingproducers() { // a binding is created for each app supplied with the name of the app isahc::get(producera.uri()).expectstatusok(); isahc::get(producerb.uri()).expectstatus_ok(); } ```