X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fdata-serializer.t;h=7fb39329d49583ddf43e22ce97d6d56a24642a01;hb=e52456a4e301e6443284318748eb328641d8737a;hp=740a24e66912a4f04140cb63111dc6d219fece3a;hpb=8f00a41bd7efb75d302d0a333e0eb5bc7d75c931;p=catagits%2FCatalyst-Action-REST.git diff --git a/t/data-serializer.t b/t/data-serializer.t index 740a24e..7fb3932 100644 --- a/t/data-serializer.t +++ b/t/data-serializer.t @@ -1,6 +1,6 @@ use strict; use warnings; -use Test::More qw(no_plan); +use Test::More; use FindBin; use lib ( "$FindBin::Bin/lib", "$FindBin::Bin/../lib" ); @@ -59,4 +59,24 @@ foreach my $content_type (keys(%ctypes)) { } } +{ + my $t = Test::Rest->new( 'content_type' => 'text/x-data-dumper' ); + + my $post_data = "{ 'sushi' => die('hack attempt') }"; + my $mres_post = request( + $t->post( + url => '/monkey_put', + data => $post_data, + ) + ); + ok( ! $mres_post->is_success, "POST Data::Dumper fails due to invalid input" ); + like( + $mres_post->content, + qr%Content-Type text/x-data-dumper had a problem with your request.*'die' trapped by operation mask%s, + "POST Data::Dumper data error matches" + ); +} + 1; + +done_testing;