Browse files

fixed $r->args in list context

  • Loading branch information...
1 parent f28aa02 commit 61e5ea5d366a872b1e724dfd6ab494e373eb52e3 @spiritloose committed Dec 21, 2010
Showing with 8 additions and 2 deletions.
  1. +5 −1 lib/Sledge/Request/PSGI.pm
  2. +3 −1 t/02_request.t
View
6 lib/Sledge/Request/PSGI.pm
@@ -69,7 +69,11 @@ sub uri {
sub args {
my $self = shift;
- return $self->env->{QUERY_STRING};
+ if (wantarray) {
+ return map { $_ => scalar $self->param($_) } $self->param;
+ } else {
+ return $self->env->{QUERY_STRING};
+ }
}
sub upload {
View
4 t/02_request.t
@@ -1,5 +1,5 @@
use strict;
-use Test::More tests => 19;
+use Test::More tests => 20;
BEGIN { $ENV{SLEDGE_CONFIG_NAME} = '_test' }
use Plack::Test;
use HTTP::Request::Common;
@@ -15,6 +15,8 @@ sub dispatch_get {
ok !$self->is_post_request;
is $self->r->uri, '/get';
is $self->r->args, 'foo=bar';
+ my %args = $self->r->args;
+ is $args{foo}, 'bar';
is $self->r->param('foo'), 'bar';
is $self->r->header_in('X-Foobar'), 'foobar';

0 comments on commit 61e5ea5

Please sign in to comment.