In the actix-web documentation, there are two examples on how to build a TestServer
with either a factory function:
use actix_web::{http, test, App, HttpRequest, HttpResponse};
// ...
fn main() {
let mut srv = test::TestServer::with_factory(create_app);
// ...
}
or with application state:
fn test() {
let srv = TestServer::build_with_state(|| {
// ...
});
// run tests
}
I would like to build a TestServer
with state and using a factory function, but haven't been successful so far.
How can this be accomplished?