Struct actix_web::test::TestServer [] [src]

pub struct TestServer { /* fields omitted */ }

The TestServer type.

TestServer is very simple test server that simplify process of writing integration tests cases for actix web applications.

Examples

use actix_web::test::TestServer;

let mut srv = TestServer::new(|app| app.handler(my_handler));

let req = srv.get().finish().unwrap();
let response = srv.execute(req.send()).unwrap();
assert!(response.status().is_success());

Methods

impl TestServer
[src]

[src]

Start new test server

This method accepts configuration method. You can add middlewares or set handlers for test application.

[src]

Start new test server with application factory

[src]

Start new test server with custom application state

This method accepts state factory and configuration method.

[src]

Get firat available unused address

[src]

Construct test server url

[src]

Construct test server url

[src]

Execute future on current core

[src]

Connect to websocket server

[src]

Create GET request

[src]

Create POST request

[src]

Create HEAD request

[src]

Connect to test http server

Trait Implementations

impl Drop for TestServer
[src]

[src]

Executes the destructor for this type. Read more