Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to receive json parameters correctly? #202

Open
disburden opened this issue Feb 10, 2025 · 0 comments
Open

How to receive json parameters correctly? #202

disburden opened this issue Feb 10, 2025 · 0 comments

Comments

@disburden
Copy link

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!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant