X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Fcontent_negotiation.t;fp=t%2Fcontent_negotiation.t;h=df6a3c560e6b6b2bc65bf911079a4485d52abb3a;hp=38eb181ef8da1fb4373e0694d777c2945152bdc8;hb=d15db19cbcfd1896251aa7704907fb76b552beb7;hpb=982d7488f79d1c7c489e8e84e1556e22132c0a3d diff --git a/t/content_negotiation.t b/t/content_negotiation.t index 38eb181..df6a3c5 100644 --- a/t/content_negotiation.t +++ b/t/content_negotiation.t @@ -6,9 +6,38 @@ use strict; use FindBin; use Test::More; use HTTP::Request::Common; +use JSON::MaybeXS; use lib "$FindBin::Bin/lib"; use Catalyst::Test 'TestContentNegotiation'; +{ + ok my $req = POST '/', + Content_Type => 'application/json', + Content => encode_json +{message=>'test'}; + + ok my $res = request $req; + + is $res->content, 'is_json'; +} + +{ + ok my $req = POST '/', [a=>1,b=>2]; + ok my $res = request $req; + + is $res->content, 'is_urlencoded'; +} + +{ + ok my $path = TestContentNegotiation->path_to(qw/share file.txt/); + ok my $req = POST '/', + Content_Type => 'form-data', + Content => [a=>1, b=>2, file=>["$path"]]; + + ok my $res = request $req; + + is $res->content, 'is_multipart'; +} + done_testing;