uri_for and prefix don't seem to work as expected #1743
Unanswered
estrella-red
asked this question in
Q&A
Replies: 1 comment
-
I know what is happening to cause uri_for_route to fail on forward:
http request for /bar prior to forward:
http request for /bar after forward to /foo: This behaviour is alluded to in the docs "when forward is executed, the current dispatch of the route is aborted, the request is modified". Can this be changed so that uri_for_route is preserved? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I have recently returned to Dancer2 (1.1.2) after a long absence, an am struggling to make sense of uri_for and uri_for_route when used under prefix. uri_for works fine when my app uses a single routes file, but as soon as I split into 2 (or more), as shown in cookbook, uri_for ignores the prefix so my url's don't work. So:
the same behaviour in templates: request.uri_for('/search')) omits the prefix when it should exist
uri_for_route does recognise the prefix, but fails if the route contains a 'forward', generating an error "uri_for_route called on a request instance without it" at line #323 in D2::Core::Request due to $self->{'uri_for_route'} being undef. Incidentally this error message is rather unhelpful.
Something I am doing wrong, or bugs?
Beta Was this translation helpful? Give feedback.
All reactions