1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-01-30 18:42:52 +01:00

Make test_server async fn

This commit is contained in:
Yuki Okushi 2020-03-08 16:42:26 +09:00
parent b93e1555ec
commit a9a475d555
No known key found for this signature in database
GPG Key ID: B0986C85C0E2DAA1
2 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@
* Update the `time` dependency to 0.2.7 * Update the `time` dependency to 0.2.7
* Update `actix-connect` dependency to 2.0.0-alpha.2 * Update `actix-connect` dependency to 2.0.0-alpha.2
* Make `test_server` `async` fn.
## [1.0.0] - 2019-12-13 ## [1.0.0] - 2019-12-13

View File

@ -43,7 +43,7 @@ pub use actix_testing::*;
/// assert!(response.status().is_success()); /// assert!(response.status().is_success());
/// } /// }
/// ``` /// ```
pub fn test_server<F: ServiceFactory<TcpStream>>(factory: F) -> TestServer { pub async fn test_server<F: ServiceFactory<TcpStream>>(factory: F) -> TestServer {
let (tx, rx) = mpsc::channel(); let (tx, rx) = mpsc::channel();
// run server in separate thread // run server in separate thread
@ -92,7 +92,7 @@ pub fn test_server<F: ServiceFactory<TcpStream>>(factory: F) -> TestServer {
Client::build().connector(connector).finish() Client::build().connector(connector).finish()
}; };
actix_connect::start_default_resolver(); actix_connect::start_default_resolver().await.unwrap();
TestServer { TestServer {
addr, addr,