[Catalyst-commits] r14341 - in trunk/HTTP-Body: . lib/HTTP

getty at dev.catalyst.perl.org getty at dev.catalyst.perl.org
Wed Oct 3 15:18:47 GMT 2012


Author: getty
Date: 2012-10-03 15:18:47 +0000 (Wed, 03 Oct 2012)
New Revision: 14341

Modified:
   trunk/HTTP-Body/dist.ini
   trunk/HTTP-Body/lib/HTTP/Body.pm
Log:
Added patch of gbjk, released 1.16



Modified: trunk/HTTP-Body/dist.ini
===================================================================
--- trunk/HTTP-Body/dist.ini	2012-09-19 04:22:06 UTC (rev 14340)
+++ trunk/HTTP-Body/dist.ini	2012-10-03 15:18:47 UTC (rev 14341)
@@ -1,5 +1,5 @@
 name    = HTTP-Body
-version = 1.15
+version = 1.16
 author  = Christian Hansen, C<chansen at cpan.org>
 author  = Sebastian Riedel, C<sri at cpan.org>
 author  = Andy Grundman, C<andy at hybridized.org>

Modified: trunk/HTTP-Body/lib/HTTP/Body.pm
===================================================================
--- trunk/HTTP-Body/lib/HTTP/Body.pm	2012-09-19 04:22:06 UTC (rev 14340)
+++ trunk/HTTP-Body/lib/HTTP/Body.pm	2012-10-03 15:18:47 UTC (rev 14341)
@@ -9,7 +9,8 @@
     'application/x-www-form-urlencoded' => 'HTTP::Body::UrlEncoded',
     'multipart/form-data'               => 'HTTP::Body::MultiPart',
     'multipart/related'                 => 'HTTP::Body::XFormsMultipart',
-    'application/xml'                   => 'HTTP::Body::XForms'
+    'application/xml'                   => 'HTTP::Body::XForms',
+    'application/json'                  => 'HTTP::Body::OctetStream',
 };
 
 require HTTP::Body::OctetStream;
@@ -55,9 +56,9 @@
 
 =head1 DESCRIPTION
 
-HTTP::Body parses chunks of HTTP POST data and supports 
-application/octet-stream, application/x-www-form-urlencoded, and
-multipart/form-data.
+HTTP::Body parses chunks of HTTP POST data and supports
+application/octet-stream, application/json, application/x-www-form-urlencoded,
+and multipart/form-data.
 
 Chunked bodies are supported by not passing a length value to new().
 
@@ -89,9 +90,12 @@
     }
 
     my $type;
+    my $earliest_index;
     foreach my $supported ( keys %{$TYPES} ) {
-        if ( index( lc($content_type), $supported ) >= 0 ) {
-            $type = $supported;
+        my $index = index( lc($content_type), $supported );
+        if ($index >= 0 && (!defined $earliest_index || $index < $earliest_index)) {
+            $type           = $supported;
+            $earliest_index = $index;
         }
     }
 




More information about the Catalyst-commits mailing list