mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-23 16:21:06 +01:00
fix doc tests
This commit is contained in:
parent
8d5d6a2598
commit
ad27150c5f
@ -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"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -61,7 +61,7 @@ type DefaultHandler<B> = Option<Rc<ErrorHandler<B>>>;
|
||||
/// 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(
|
||||
/// header::CONTENT_TYPE,
|
||||
/// header::HeaderValue::from_static("Error"),
|
||||
@ -115,7 +115,7 @@ type DefaultHandler<B> = Option<Rc<ErrorHandler<B>>>;
|
||||
/// # middleware::{ErrorHandlerResponse, ErrorHandlers},
|
||||
/// # 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(
|
||||
/// header::CONTENT_TYPE,
|
||||
/// header::HeaderValue::from_static("Error"),
|
||||
@ -125,7 +125,7 @@ type DefaultHandler<B> = Option<Rc<ErrorHandler<B>>>;
|
||||
/// 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(
|
||||
/// header::CONTENT_TYPE,
|
||||
/// 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:
|
||||
///
|
||||
/// ```
|
||||
/// # use actix_web::http::{header, StatusCode};
|
||||
/// # use actix_web::middleware::{ErrorHandlerResponse, ErrorHandlers};
|
||||
/// # use actix_web::{dev, web, App, HttpResponse, Result};
|
||||
/// # fn add_error_header<B>(mut res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
|
||||
/// # use actix_web::{
|
||||
/// # dev::ServiceResponse,
|
||||
/// # http::{header, StatusCode},
|
||||
/// # 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(
|
||||
/// # header::CONTENT_TYPE,
|
||||
/// # header::HeaderValue::from_static("Error"),
|
||||
/// # );
|
||||
/// # 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(
|
||||
/// # header::CONTENT_TYPE,
|
||||
/// # header::HeaderValue::from_static("Bad Request Error"),
|
||||
|
Loading…
Reference in New Issue
Block a user