Fix failed test

This commit is contained in:
Naiker 2023-02-07 20:21:42 +00:00
parent 7f36b295d7
commit b3abb4a08b
1 changed files with 4 additions and 1 deletions

View File

@ -72,6 +72,9 @@ type DefaultHandler<B> = Option<Rc<ErrorHandler<B>>>;
/// ///
/// Body Content /// Body Content
/// ``` /// ```
/// use actix_web::http::{header, StatusCode};
/// use actix_web::middleware::{ErrorHandlerResponse, ErrorHandlers};
/// use actix_web::{dev, web, App, HttpResponse, Result};
/// fn add_error_body<B>(res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> { /// fn add_error_body<B>(res: dev::ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>> {
/// // Get the error message and status code /// // Get the error message and status code
/// let error_message = "An error occurred"; /// let error_message = "An error occurred";
@ -80,7 +83,7 @@ type DefaultHandler<B> = Option<Rc<ErrorHandler<B>>>;
/// // Create a new response with the modified body /// // Create a new response with the modified body
/// let res = res.set_body(error_message).map_into_boxed_body(); /// let res = res.set_body(error_message).map_into_boxed_body();
/// // Create a new ServiceResponse with the modified response /// // Create a new ServiceResponse with the modified response
/// let res = ServiceResponse::new(req, res).map_into_right_body(); /// let res = dev::ServiceResponse::new(req, res).map_into_right_body();
/// Ok(ErrorHandlerResponse::Response(res)) /// Ok(ErrorHandlerResponse::Response(res))
///} ///}
/// ///