2

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?

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
trolle3000
  • 1,067
  • 2
  • 14
  • 27

0 Answers0