-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce new DSL keyword: uri_for_route:
This new DSL provides a uri_for()-style resolution, but uses named routes for this. get 'view_product' => '/view/:product/:id' => sub {...}; get 'scary' => '/*/:foo/**' => sub {...}; # somewhere else in your App my $uri = uri_for_route( 'view_product' => { 'product' => 'phone', 'id' => 'K2V3', }); # $uri = /view/phone/K2V3 $uri = uri_for_route( 'view_product', { 'foo' => 'bar', 'splat' => [ 'baz', ['quux'] ], }, { 'id' => 4 }, ); # /baz/bar/quux?id=4 * This works on any non-HEAD method (GET, POST, PATCH, PUT, DELETE, and if you create your own). * Splat and Megasplat are supported. Mixing it with named params is also supported. * Query parameters are supported. * HTML escaping is supported. * `request.uri_for_route()` in templates is also supported. * Lots of testing. * Documentation updated.
- Loading branch information
Showing
10 changed files
with
549 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.