Improve performance by skipping body processing if we don't have Content-Length
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Request.pm
index 7624db7..40825b7 100644 (file)
@@ -146,6 +146,10 @@ C<application/x-www-form-urlencoded> or C<multipart/form-data>.
 sub body {
     my ( $self, $body ) = @_;
     $self->{_context}->prepare_body;
+    
+    return unless $self->{_body};
+    
+    $self->{_body}->body($body) if $body;
     return $self->{_body}->body;
 }
 
@@ -484,7 +488,8 @@ sub upload {
 =head2 $req->uploads
 
 Returns a reference to a hash containing uploads. Values can be either a
-hashref or a arrayref containing L<Catalyst::Request::Upload> objects.
+L<Catalyst::Request::Upload> object, or an arrayref of 
+L<Catalyst::Request::Upload> objects.
 
     my $upload = $c->request->uploads->{field};
     my $upload = $c->request->uploads->{field}->[0];