Dancer::Request::new_for_request does not handle ajax request correctly. Below test is failed. ------------------------------------------------------------------------------------------ use Test::More; use Dancer ':syntax'; use Dancer::Plugin::Ajax; ajax '/req' => sub { return "hello"; }; use Dancer::Test; my $response = dancer_response GET => '/req', {headers => [ "x-requested-with" => "XMLHttpRequest", ] }; is $response->{content}, "hello", "response content looks good for AJAX GET /req"; $response = dancer_response POST => '/req', {headers => [ "x-requested-with" => "XMLHttpRequest", ] }; is $response->{content}, "hello", "response content looks good for AJAX GET /req"; done_testing(); ------------------------------------------------------------------------------------------ This error is fixed by below patch. But It do not seem to me proper fix. --- Request.pm.orig 2011-07-17 20:38:30.392932771 +0900 +++ Request.pm 2011-07-17 20:38:15.845590732 +0900 @@ -147,6 +147,7 @@ $req->{_query_params} = $req->{params}; $req->{body} = $body if defined $body; $req->{headers} = $headers if $headers; + $req->{ajax} = $req->is_ajax; return $req; } Best regards. -- Takeshi OKURA