// this method returns an OK status when the wakka header exists.
this method returns an OK status when the wakka header exists.
this method returns an OK status when the wakka header exists .
async fn two(
            req: Request<Body>,
            mut response: Option<Response<Body>>,
            _params: Params,
            _app: App<State, NoState>,
            _state: NoState,
        ) -> HTTPResult<NoState> {
            if let Some(header) = req.headers().get("wakka") {
                if header != "wakka wakka" {
                    return Err(Error::new("invalid header value"));
                }
                if response.is_some() {
                    return Ok((req, response, NoState {}));
                } else {
                    let resp = Response::builder()
                        .status(StatusCode::OK)
                        .body(Body::default())?;
                    response.replace(resp);
                    return Ok((req, response, NoState {}));
                }
            }
            Err(Error::default())
        }
async fn two ( req : Request < Body > , mut response : Option < Response < Body > > , _params : Params , _app : App < State , NoState > , _state : NoState , ) -> HTTPResult < NoState > { if let Some ( header ) = req . headers ( ) . get ( " " ) { if header != " " { return Err ( Error :: new ( " " ) ) ; } if response . is_some ( ) { return Ok ( ( req , response , NoState { } ) ) ; } else { let resp = Response :: builder ( ) . status ( StatusCode :: OK ) . body ( Body :: default ( ) ) ? ; response . replace ( resp ) ; return Ok ( ( req , response , NoState { } ) ) ; } } Err ( Error :: default ( ) ) }
this method returns an OK status when the wakka header exists.
this method returns an OK status when the wakka header exists .
req
Request<Body>
response
Option<Response<Body>>
_params
Params
_app
App<State, NoState>
_state
NoState