Skip to content
Discussion options

You must be logged in to vote

Thank you.
Is it possible to use only one parameter instead of two ?
Maybe a new struct RequestAndPayload with both fields and impl FromRequest ?
Could this work?

use actix_utils::future::Ready;
use actix_web::error::Error;

pub struct RequestAndPayload{
    req: actix_web::HttpRequest, 
    pl: actix_web::dev::Payload,    
}

impl actix_web::FromRequest for RequestAndPayload {
    type Error = Error;
    type Future = Ready<Result<Self, Error>>;

    #[inline]
    fn from_request(
        req: &actix_web::HttpRequest,
        pl: &mut actix_web::dev::Payload,
    ) -> Self::Future {
        let rap = RequestAndPayload{
            req : req.to_owned(),
            pl : pl.take(),
        };

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bestia-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants