Improve performance by skipping body processing if we don't have Content-Length
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Request.pm
index 219a7c1..40825b7 100644 (file)
@@ -81,7 +81,11 @@ thus hiding the details of the particular engine implementation.
 
 =head2 $req->action
 
-Returns the requested action as a L<Catalyst::Action> object.
+[DEPRECATED] Returns the name of the requested action.
+
+
+Use C<< $c->action >> instead (which returns a
+L<Catalyst::Action|Catalyst::Action> object).
 
 =head2 $req->address
 
@@ -142,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;
 }
 
@@ -480,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];
@@ -512,6 +521,7 @@ sub uri_with {
     carp( 'No arguments passed to uri_with()' ) unless $args;
 
     for my $value ( values %$args ) {
+        next unless defined $value;
         for ( ref $value eq 'ARRAY' ? @$value : $value ) {
             $_ = "$_";
             utf8::encode( $_ );