Skip to content
Browse files

Merge branch 'master' of github.com:miyagawa/Plack

  • Loading branch information...
2 parents 5e361d3 + 4f68dc4 commit b83ea456cdf649c54df37081de6261016092b541 @miyagawa miyagawa committed Jul 5, 2012
Showing with 19 additions and 2 deletions.
  1. +4 −1 lib/Plack/Request.pm
  2. +15 −1 t/Plack-Request/uri.t
View
5 lib/Plack/Request.pm
@@ -83,7 +83,10 @@ sub cookies {
sub query_parameters {
my $self = shift;
- $self->env->{'plack.request.query'} ||= Hash::MultiValue->new($self->uri->query_form);
+ my @combined = $self->uri->query_form;
+ @combined = (@combined, map { $_, '' } $self->uri->query_keywords);
+
+ $self->env->{'plack.request.query'} ||= Hash::MultiValue->new(@combined);
}
sub content {
View
16 t/Plack-Request/uri.t
@@ -61,10 +61,24 @@ my @tests = (
{ add_env => {
HTTP_HOST => 'example.com',
SCRIPT_NAME => "",
+ QUERY_STRING => "foo_only"
+ },
+ uri => 'http://example.com/?foo_only',
+ parameters => { foo_only => '' } },
+ { add_env => {
+ HTTP_HOST => 'example.com',
+ SCRIPT_NAME => "",
+ QUERY_STRING => "foo&bar=baz"
+ },
+ uri => 'http://example.com/?foo&bar=baz',
+ parameters => { foo => '', bar => 'baz' } },
+ { add_env => {
+ HTTP_HOST => 'example.com',
+ SCRIPT_NAME => "",
QUERY_STRING => 0
},
uri => 'http://example.com/?0',
- parameters => {} },
+ parameters => { 0 => '' } },
{ add_env => {
HTTP_HOST => 'example.com',
SCRIPT_NAME => "/foo bar",

0 comments on commit b83ea45

Please sign in to comment.
Something went wrong with that request. Please try again.