From ad27150c5fea237789ce110a71fe724678dcfb22 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 26 Feb 2023 14:14:04 +0000 Subject: [PATCH] fix doc tests --- actix-http-test/Cargo.toml | 2 +- actix-web/Cargo.toml | 2 +- actix-web/src/middleware/err_handlers.rs | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/actix-http-test/Cargo.toml b/actix-http-test/Cargo.toml index 7c6190bd3..cd5e87162 100644 --- a/actix-http-test/Cargo.toml +++ b/actix-http-test/Cargo.toml @@ -41,7 +41,7 @@ bytes = "1" futures-core = { version = "0.3.17", default-features = false } http = "0.2.5" log = "0.4" -socket2 = "0.5" +socket2 = "0.4" serde = "1.0" serde_json = "1.0" slab = "0.4" diff --git a/actix-web/Cargo.toml b/actix-web/Cargo.toml index 81235395b..664379c79 100644 --- a/actix-web/Cargo.toml +++ b/actix-web/Cargo.toml @@ -93,7 +93,7 @@ serde = "1.0" serde_json = "1.0" serde_urlencoded = "0.7" smallvec = "1.6.1" -socket2 = "0.5" +socket2 = "0.4" time = { version = "0.3", default-features = false, features = ["formatting"] } url = "2.1" diff --git a/actix-web/src/middleware/err_handlers.rs b/actix-web/src/middleware/err_handlers.rs index 557fa3849..5522cc021 100644 --- a/actix-web/src/middleware/err_handlers.rs +++ b/actix-web/src/middleware/err_handlers.rs @@ -61,7 +61,7 @@ type DefaultHandler = Option>>; /// web, App, HttpResponse, Result, /// }; /// -/// fn add_error_header(mut res: dev::ServiceResponse) -> Result> { +/// fn add_error_header(mut res: ServiceResponse) -> Result> { /// res.response_mut().headers_mut().insert( /// header::CONTENT_TYPE, /// header::HeaderValue::from_static("Error"), @@ -115,7 +115,7 @@ type DefaultHandler = Option>>; /// # middleware::{ErrorHandlerResponse, ErrorHandlers}, /// # web, App, HttpResponse, Result, /// # }; -/// fn add_error_header(mut res: dev::ServiceResponse) -> Result> { +/// fn add_error_header(mut res: ServiceResponse) -> Result> { /// res.response_mut().headers_mut().insert( /// header::CONTENT_TYPE, /// header::HeaderValue::from_static("Error"), @@ -125,7 +125,7 @@ type DefaultHandler = Option>>; /// Ok(ErrorHandlerResponse::Response(res.map_into_left_body())) /// } /// -/// fn handle_bad_request(mut res: dev::ServiceResponse) -> Result> { +/// fn handle_bad_request(mut res: ServiceResponse) -> Result> { /// res.response_mut().headers_mut().insert( /// header::CONTENT_TYPE, /// header::HeaderValue::from_static("Bad Request Error"), @@ -149,17 +149,20 @@ type DefaultHandler = Option>>; /// You can set default handlers for all client (4xx) or all server (5xx) errors: /// /// ``` -/// # use actix_web::http::{header, StatusCode}; -/// # use actix_web::middleware::{ErrorHandlerResponse, ErrorHandlers}; -/// # use actix_web::{dev, web, App, HttpResponse, Result}; -/// # fn add_error_header(mut res: dev::ServiceResponse) -> Result> { +/// # use actix_web::{ +/// # dev::ServiceResponse, +/// # http::{header, StatusCode}, +/// # middleware::{ErrorHandlerResponse, ErrorHandlers}, +/// # web, App, HttpResponse, Result, +/// # }; +/// # fn add_error_header(mut res: ServiceResponse) -> Result> { /// # res.response_mut().headers_mut().insert( /// # header::CONTENT_TYPE, /// # header::HeaderValue::from_static("Error"), /// # ); /// # Ok(ErrorHandlerResponse::Response(res.map_into_left_body())) /// # } -/// # fn handle_bad_request(mut res: dev::ServiceResponse) -> Result> { +/// # fn handle_bad_request(mut res: ServiceResponse) -> Result> { /// # res.response_mut().headers_mut().insert( /// # header::CONTENT_TYPE, /// # header::HeaderValue::from_static("Bad Request Error"),