[dancer-users] Redirect to another POST page?

Jeff Boes jeff at endpoint.com
Thu Jan 8 19:48:50 GMT 2015


I have a page that responds to a POST request:

post '/checkout' => sub { ... };

Then, I have another page that does some different work before this page can be processed. I want to redirect to the
/checkout page as a POST, so the URL ends up as "/checkout" with no visible parameters.

Long version of the explanation: the /checkout page is my cart checkout page. However, the user might be an "admin"
user, working from an order creation page that is unlike the normal cart page. So while a normal user goes through

/flypage => /cart => /checkout

an Admin user would go through

get /order/new => post /order/new => /checkout

I got this working with a "forward" operation at the end of my interstitial page,

forward '/checkout', { ... several parameters here ... };

but the only drawback here is that the
admin user ends up looking at a URL that is not "/checkout", even though the page contents are what they would see at
"/checkout".

I can get the URL right if I replace "forward" with "redirect":

redirect uri_for '/checkout', { ... several parameters here ... }

which leaves the browser at

.../checkout?foo=...&bar=...&blah=...

Ugly. I just want to end up on "/checkout", with my parameters hidden away. Is there any hope?

-- 
Jeff Boes <><
jeff at endpoint.com
269-408-0811


More information about the dancer-users mailing list