From f99a723643d3e0618068acb2631331e3c25f6dba Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Mon, 8 Oct 2018 15:52:12 -0700 Subject: [PATCH] add Default impl for ServiceConfig --- src/config.rs | 6 ++++++ tests/test_ws.rs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 2e14a33e6..ff22ea486 100644 --- a/src/config.rs +++ b/src/config.rs @@ -57,6 +57,12 @@ impl Clone for ServiceConfig { } } +impl Default for ServiceConfig { + fn default() -> Self { + Self::new(KeepAlive::Timeout(5), 0, 0) + } +} + impl ServiceConfig { /// Create instance of `ServiceConfig` pub(crate) fn new( diff --git a/tests/test_ws.rs b/tests/test_ws.rs index 8a1098747..00ccd1558 100644 --- a/tests/test_ws.rs +++ b/tests/test_ws.rs @@ -18,7 +18,7 @@ use bytes::Bytes; use futures::future::{ok, Either}; use futures::{Future, Sink, Stream}; -use actix_http::{h1, ws, ResponseError}; +use actix_http::{h1, ws, ResponseError, ServiceConfig}; fn ws_service(req: ws::Message) -> impl Future { match req { @@ -36,7 +36,7 @@ fn test_simple() { thread::spawn(move || { Server::new() .bind("test", addr, move || { - IntoFramed::new(|| h1::Codec::new(false)) + IntoFramed::new(|| h1::Codec::new(ServiceConfig::default())) .and_then(TakeItem::new().map_err(|_| ())) .and_then(|(req, framed): (_, Framed<_, _>)| { // validate request