Skip to content

How to use url_for in mounted router? #132

@flosse

Description

@flosse

let's say I mounted a router to admin/ and use url_for within a handler of that router.

let routes = router!(
  foo: post "foo" => |req: &mut Request| {
    Ok(Response::with(Redirect(url_for!(req, "dashboard"))))
});
let admin = Chain::new(router);
let mut mounts = Mount::new();
mounts.mount("/admin", routes);

The redirect url points to /dashboard instead of /admin/dashboard.
How would you solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions