mirror of https://github.com/fafhrd91/actix-web
tweak example docs
This commit is contained in:
parent
32b4184530
commit
aa726ba8d9
|
@ -34,9 +34,9 @@ use crate::{dev::Payload, FromRequest, HttpRequest};
|
||||||
/// req: HttpRequest,
|
/// req: HttpRequest,
|
||||||
/// opt_flag: Option<web::ReqData<FlagFromMiddleware>>,
|
/// opt_flag: Option<web::ReqData<FlagFromMiddleware>>,
|
||||||
/// ) -> impl Responder {
|
/// ) -> impl Responder {
|
||||||
|
/// // use an optional extractor if the middleware is
|
||||||
|
/// // not guaranteed to add this type of requests data
|
||||||
/// if let Some(flag) = opt_flag {
|
/// if let Some(flag) = opt_flag {
|
||||||
/// // using an optional extractor since the middleware may
|
|
||||||
/// // not be guaranteed to add our flag to request data
|
|
||||||
/// assert_eq!(&flag.into_inner(), req.extensions().get::<FlagFromMiddleware>().unwrap());
|
/// assert_eq!(&flag.into_inner(), req.extensions().get::<FlagFromMiddleware>().unwrap());
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue