X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Action-REST.git;a=blobdiff_plain;f=lib%2FCatalyst%2FRequest%2FREST.pm;h=16c1e6a5e1cfe94b8b39bfe751d32eeb4cccb0e6;hp=41d2a213f46b6a14eb126ba86c095647e1799ff3;hb=5bbe8fb2380d1d5bc86eb0e595f30c76aa29d6b2;hpb=2db3da90aebd1eae9ae3bebea3e1e3ccc3215c38 diff --git a/lib/Catalyst/Request/REST.pm b/lib/Catalyst/Request/REST.pm index 41d2a21..16c1e6a 100644 --- a/lib/Catalyst/Request/REST.pm +++ b/lib/Catalyst/Request/REST.pm @@ -128,6 +128,13 @@ sub accepted_content_types { my ( $type, $qvalue ) = @{$pair}[ 0, 3 ]; next if $types{$type}; + # cope with invalid (missing required q parameter) header like: + # application/json; charset="utf-8" + # http://tools.ietf.org/html/rfc2616#section-14.1 + unless ( defined $pair->[2] && lc $pair->[2] eq 'q' ) { + $qvalue = undef; + } + unless ( defined $qvalue ) { $qvalue = 1 - ( ++$counter / 1000 ); }