lala
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Request.pm
index f9ff7b3..46e0df6 100644 (file)
@@ -5,6 +5,8 @@ use base 'Class::Accessor::Fast';
 
 use IO::Socket qw[AF_INET inet_aton];
 use Carp;
+use utf8;
+use URI::QueryParam;
 
 __PACKAGE__->mk_accessors(
     qw/action address arguments cookies headers match method
@@ -66,7 +68,7 @@ Catalyst::Request - provides information about the current client request
     $req->user;
     $req->user_agent;
 
-See also L<Catalyst>.
+See also L<Catalyst>, L<Catalyst::Request::Upload>.
 
 =head1 DESCRIPTION
 
@@ -502,10 +504,17 @@ sub uri_with {
     
     carp( 'No arguments passed to uri_with()' ) unless $args;
     
+    for my $value ( values %$args ) {
+        my $isa_ref = ref $value;
+        if( $isa_ref and $isa_ref ne 'ARRAY' ) {
+            croak( "Non-array reference ($isa_ref) passed to uri_with()" );
+        }
+        utf8::encode( $_ ) for $isa_ref ? @$value : $value;
+    };
     my $uri = $self->uri->clone;
     
     $uri->query_form( {
-        $uri->query_form,
+        %{ $uri->query_form_hash },
         %$args
     } );
     return $uri;