This messes up all internal paths in Catalyst though. So I figured out that if I could clean up the suffix at the end of the URI, and keep it as the format parameter, I'd solved the problem. So here's the code:
# inside My::Catalyst::App
after 'prepare_path' => sub {
my ($c) = @_;
local $_ = $c->request->path;
s/\.([a-z]+)$//i;
$c->stash->{format} = lc $1 || 'html';
$c->request->path($_);
};
No comments:
Post a Comment