Hi Guys Just a quick one today. I have created a...
# fw1
c
Hi Guys Just a quick one today. I have created a redirect:
Copy code
variables.fw.redirect(action='question.form',append="questionid");
Which displays:
Copy code
<https://www.foo.com/question/form/questionid/31>
But I also have a route:
Copy code
...
generateSES = true,
SESOmitIndex = true,
routes = [
    {"$*/question/edit/questionid/([0-9]+)/?$" = "/question/form/questionid/\1"},
...
Surely, the
redirect()
&
buildURL()
methods, should add the route conversion as well? So, I would expect the following to be displayed in the address bar:
Copy code
<https://www.foo.com/question/edit/questionid/31>
Have I uncovered a bug, or maybe these methods do not analyze the routes, when converting links into SES links.
s
Routing is unidirectional: it's applied inbound on requests, not outbound on responses (so
redirect()
and
buildURL()
do not consider route mappings). It's an interesting potential enhancement -- but no one's maintaining FW/1 these days so it is very unlikely to get added, unless you decide to implement it and submit a PR.
πŸ‘ 1
c
Thanks Sean. Much obliged for the insight. I will see if I can add a PR and try and add the enhancement...
s
It would need to be something that users opt into -- perhaps an optional extra option to
redirect()
and
buildURL()
-- so that it doesn't break any existing users' code.
πŸ‘ 1
c
Maybe something like:
Copy code
public void function redirect( string action, string preserve = β€œnone”, string append = β€œnone”, string path = see below, any queryString = β€˜β€™, string statusCode = β€˜302’, string header = β€˜β€™,boolean applyRoute = false)