1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

simplify server start method

This commit is contained in:
Nikolay Kim
2017-12-19 09:08:36 -08:00
parent 4f6145e5c7
commit 13cbfc877d
9 changed files with 20 additions and 17 deletions

View File

@ -18,7 +18,7 @@ fn test_serve() {
let srv = HttpServer::new(
|| vec![Application::new()
.resource("/", |r| r.method(Method::GET).h(httpcodes::HTTPOk))]);
srv.bind("127.0.0.1:58902").unwrap().start().unwrap();
srv.bind("127.0.0.1:58902").unwrap().start();
sys.run();
});
assert!(reqwest::get("http://localhost:58902/").unwrap().status().is_success());
@ -39,7 +39,7 @@ fn test_serve_incoming() {
|| Application::new()
.resource("/", |r| r.method(Method::GET).h(httpcodes::HTTPOk)));
let tcp = TcpListener::from_listener(tcp, &addr2, Arbiter::handle()).unwrap();
srv.start_incoming(tcp.incoming(), false).unwrap();
srv.start_incoming(tcp.incoming(), false);
sys.run();
});
@ -90,7 +90,7 @@ fn test_middlewares() {
finish: Arc::clone(&act_num3)})
.resource("/", |r| r.method(Method::GET).h(httpcodes::HTTPOk))])
.bind("127.0.0.1:58904").unwrap()
.start().unwrap();
.start();
sys.run();
});