mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 08:22:59 +01:00
add Default impl for ServiceConfig
This commit is contained in:
parent
3984ad45df
commit
f99a723643
@ -57,6 +57,12 @@ impl Clone for ServiceConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ServiceConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::new(KeepAlive::Timeout(5), 0, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ServiceConfig {
|
impl ServiceConfig {
|
||||||
/// Create instance of `ServiceConfig`
|
/// Create instance of `ServiceConfig`
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
|
@ -18,7 +18,7 @@ use bytes::Bytes;
|
|||||||
use futures::future::{ok, Either};
|
use futures::future::{ok, Either};
|
||||||
use futures::{Future, Sink, Stream};
|
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<Item = ws::Message, Error = io::Error> {
|
fn ws_service(req: ws::Message) -> impl Future<Item = ws::Message, Error = io::Error> {
|
||||||
match req {
|
match req {
|
||||||
@ -36,7 +36,7 @@ fn test_simple() {
|
|||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
Server::new()
|
Server::new()
|
||||||
.bind("test", addr, move || {
|
.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(TakeItem::new().map_err(|_| ()))
|
||||||
.and_then(|(req, framed): (_, Framed<_, _>)| {
|
.and_then(|(req, framed): (_, Framed<_, _>)| {
|
||||||
// validate request
|
// validate request
|
||||||
|
Loading…
Reference in New Issue
Block a user