Skip to content

Commit

Permalink
Minor cleanup of comments and POD in Ajax plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
racke committed Apr 5, 2014
1 parent f150e84 commit a8d7787
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/Dancer2/Plugin/Ajax.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use Dancer2::Plugin;
};
# For all valid HTTP methods
ajax ['get', 'post', ... ] => '/check_for_more' =>sub {
ajax ['get', 'post', ... ] => '/check_for_more' => sub {
# ... some Ajax code
};
Expand All @@ -38,7 +38,7 @@ The route handler code will be compiled to behave like the following:
=item *
Pass if the request header X-Requested-With doesnt equal XMLHttpRequest
Pass if the request header X-Requested-With doesn't equal XMLHttpRequest
=item *
Expand All @@ -61,18 +61,15 @@ Here is example to use JSON:
Ajax:
content_type: 'application/json'
=cut

register 'ajax' => sub {
my ( $dsl, $pattern, @rest ) = @_;

my $default_methods = [ 'get', 'post' ];

# BugFix for #543
# If the given pattern is an ArrayRef, we override the defaults
# and pass these onto to SDL->any()
# and pass these onto to DSL->any()
if( ref($pattern) eq "ARRAY" ) {
$default_methods = $pattern;
$pattern = shift(@rest);
Expand Down

0 comments on commit a8d7787

Please sign in to comment.