1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-30 03:50:42 +00:00

add test with custom connector

This commit is contained in:
Nikolay Kim 2019-11-21 17:36:18 +06:00
parent 1f0577f8d5
commit 0b9e3d381b
2 changed files with 10 additions and 0 deletions

View file

@ -63,6 +63,7 @@ rust-tls = { version = "0.16.0", package="rustls", optional = true, features = [
[dev-dependencies]
actix-rt = "1.0.0-alpha.1"
actix-connect = { version = "1.0.0-alpha.1", features=["openssl"] }
actix-web = { version = "2.0.0-alpha.1", features=["openssl"] }
actix-http = { version = "0.3.0-alpha.1", features=["openssl"] }
actix-http-test = { version = "0.3.0-alpha.1", features=["openssl"] }

View file

@ -125,9 +125,18 @@ fn test_timeout() {
)))
});
let connector = awc::Connector::new()
.connector(actix_connect::new_connector(
actix_connect::start_default_resolver(),
))
.timeout(Duration::from_secs(15))
.finish();
let client = awc::Client::build()
.connector(connector)
.timeout(Duration::from_millis(50))
.finish();
let request = client.get(srv.url("/")).send();
match request.await {
Err(SendRequestError::Timeout) => (),