Skip to content

How to receive json parameters correctly? #202

@disburden

Description

@disburden

This is the routing method for post_authorize in the example code

async fn post_authorize(
    (r, req, state): (HttpRequest, OAuthRequest, web::Data<Addr<State>>), ) -> Result<OAuthResponse, WebError> {
) -> Result<OAuthResponse, WebError> {
    state
        .send(Authorize(req).wrap(Extras::AuthPost(r.query_string().to_owned())))
        .await?
}

The second parameter req is an OAuthRequest object, if I want to receive the json parameter uploaded by the client I have to change the type of this parameter to web::Json, then I lose the OAuthRequest object and can't do the subsequent operations.
How can I receive the json parameter correctly or can I manually create an OAuthRequest object in this method using the OAuthRequest::new() method to perform the subsequent operations.
Thank you!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions