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

Signing broken when using axum nested routers #73

Open
ghost opened this issue Jul 24, 2023 · 2 comments
Open

Signing broken when using axum nested routers #73

ghost opened this issue Jul 24, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Jul 24, 2023

No description provided.

@pbzweihander
Copy link
Contributor

little bit more information:

If you run an axum server with following code:

use axum::{body::Body, http::Request, routing, Router};

async fn get(req: Request<Body>) {
    println!("{}", req.uri());
}

#[tokio::main]
async fn main() {
    let api = Router::new().route("/health", routing::get(get));
    let router = Router::new().nest("/api", api);

    axum::Server::bind(&"0.0.0.0:3030".parse().unwrap())
        .serve(router.into_make_service())
        .await
        .unwrap();
}

and request to localhost:3030/api/health?foo=bar, output is like:

/health?foo=bar

When we use nested router, axum's req.uri only shows matched path of the nested router.

@pbzweihander
Copy link
Contributor

We can use MatchedPath to retrieve full path, but we have to somehow concatenate the query string.

@Nutomic Nutomic added the bug Something isn't working label Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants