-
SummarySay I have the route My current set up uses a separate router with let apub_router = Router::new()
.route("/user/:id", get(get_user))
.route_layer(ValidateRequestHeaderLayer::accept(FEDERATION_CONTENT_TYPE));
let app = Router::new()
.leptos_routes_with_context( // This generates /user/:id which conflicts with `apub_router`
&uiconf.leptos_options,
routes,
{
let state = instance_metadata.clone();
move || provide_context(state.clone())
},
App,
)
.with_state(uiconf.leptos_options.clone())
.nest("/", apub_router) Any help is appreciated! axum version0.7.7 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
A possibility is to handle this on the layer level: https://docs.rs/axum/latest/axum/response/index.html#returning-different-response-types I don't know if you have many layers, and if it's a valid approach for you. |
Beta Was this translation helpful? Give feedback.
-
This seems like another case similar to #1654 What you can do now is nesting the router under a prefix and then use middleware around the |
Beta Was this translation helpful? Give feedback.
This seems like another case similar to #1654
What you can do now is nesting the router under a prefix and then use middleware around the
Router
to rewrite the URL by prepending the same prefix based on your headers.