mirror of
https://github.com/actix/actix-web.git
synced 2025-01-23 15:38:06 +00:00
fix doc tests
This commit is contained in:
parent
8d5d6a2598
commit
ad27150c5f
3 changed files with 13 additions and 10 deletions
|
@ -41,7 +41,7 @@ bytes = "1"
|
||||||
futures-core = { version = "0.3.17", default-features = false }
|
futures-core = { version = "0.3.17", default-features = false }
|
||||||
http = "0.2.5"
|
http = "0.2.5"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
socket2 = "0.5"
|
socket2 = "0.4"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
slab = "0.4"
|
slab = "0.4"
|
||||||
|
|
|
@ -93,7 +93,7 @@ serde = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde_urlencoded = "0.7"
|
serde_urlencoded = "0.7"
|
||||||
smallvec = "1.6.1"
|
smallvec = "1.6.1"
|
||||||
socket2 = "0.5"
|
socket2 = "0.4"
|
||||||
time = { version = "0.3", default-features = false, features = ["formatting"] }
|
time = { version = "0.3", default-features = false, features = ["formatting"] }
|
||||||
url = "2.1"
|
url = "2.1"
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ type DefaultHandler<B> = Option<Rc<ErrorHandler<B>>>;
|
||||||
/// web, App, HttpResponse, Result,
|
/// web, App, HttpResponse, Result,
|
||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
/// fn add_error_header<B>(mut res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
/// fn add_error_header<B>(mut res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
||||||
/// res.response_mut().headers_mut().insert(
|
/// res.response_mut().headers_mut().insert(
|
||||||
/// header::CONTENT_TYPE,
|
/// header::CONTENT_TYPE,
|
||||||
/// header::HeaderValue::from_static("Error"),
|
/// header::HeaderValue::from_static("Error"),
|
||||||
|
@ -115,7 +115,7 @@ type DefaultHandler<B> = Option<Rc<ErrorHandler<B>>>;
|
||||||
/// # middleware::{ErrorHandlerResponse, ErrorHandlers},
|
/// # middleware::{ErrorHandlerResponse, ErrorHandlers},
|
||||||
/// # web, App, HttpResponse, Result,
|
/// # web, App, HttpResponse, Result,
|
||||||
/// # };
|
/// # };
|
||||||
/// fn add_error_header<B>(mut res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
/// fn add_error_header<B>(mut res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
||||||
/// res.response_mut().headers_mut().insert(
|
/// res.response_mut().headers_mut().insert(
|
||||||
/// header::CONTENT_TYPE,
|
/// header::CONTENT_TYPE,
|
||||||
/// header::HeaderValue::from_static("Error"),
|
/// header::HeaderValue::from_static("Error"),
|
||||||
|
@ -125,7 +125,7 @@ type DefaultHandler<B> = Option<Rc<ErrorHandler<B>>>;
|
||||||
/// Ok(ErrorHandlerResponse::Response(res.map_into_left_body()))
|
/// Ok(ErrorHandlerResponse::Response(res.map_into_left_body()))
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// fn handle_bad_request<B>(mut res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
/// fn handle_bad_request<B>(mut res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
||||||
/// res.response_mut().headers_mut().insert(
|
/// res.response_mut().headers_mut().insert(
|
||||||
/// header::CONTENT_TYPE,
|
/// header::CONTENT_TYPE,
|
||||||
/// header::HeaderValue::from_static("Bad Request Error"),
|
/// header::HeaderValue::from_static("Bad Request Error"),
|
||||||
|
@ -149,17 +149,20 @@ type DefaultHandler<B> = Option<Rc<ErrorHandler<B>>>;
|
||||||
/// You can set default handlers for all client (4xx) or all server (5xx) errors:
|
/// You can set default handlers for all client (4xx) or all server (5xx) errors:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use actix_web::http::{header, StatusCode};
|
/// # use actix_web::{
|
||||||
/// # use actix_web::middleware::{ErrorHandlerResponse, ErrorHandlers};
|
/// # dev::ServiceResponse,
|
||||||
/// # use actix_web::{dev, web, App, HttpResponse, Result};
|
/// # http::{header, StatusCode},
|
||||||
/// # fn add_error_header<B>(mut res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
/// # middleware::{ErrorHandlerResponse, ErrorHandlers},
|
||||||
|
/// # web, App, HttpResponse, Result,
|
||||||
|
/// # };
|
||||||
|
/// # fn add_error_header<B>(mut res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
||||||
/// # res.response_mut().headers_mut().insert(
|
/// # res.response_mut().headers_mut().insert(
|
||||||
/// # header::CONTENT_TYPE,
|
/// # header::CONTENT_TYPE,
|
||||||
/// # header::HeaderValue::from_static("Error"),
|
/// # header::HeaderValue::from_static("Error"),
|
||||||
/// # );
|
/// # );
|
||||||
/// # Ok(ErrorHandlerResponse::Response(res.map_into_left_body()))
|
/// # Ok(ErrorHandlerResponse::Response(res.map_into_left_body()))
|
||||||
/// # }
|
/// # }
|
||||||
/// # fn handle_bad_request<B>(mut res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
/// # fn handle_bad_request<B>(mut res: ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
||||||
/// # res.response_mut().headers_mut().insert(
|
/// # res.response_mut().headers_mut().insert(
|
||||||
/// # header::CONTENT_TYPE,
|
/// # header::CONTENT_TYPE,
|
||||||
/// # header::HeaderValue::from_static("Bad Request Error"),
|
/// # header::HeaderValue::from_static("Bad Request Error"),
|
||||||
|
|
Loading…
Reference in a new issue