Skip to content

Commit

Permalink
Cleanup request query caching #384
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Mar 8, 2013
1 parent a31f876 commit 5413ff1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/Plack/Request.pm
Expand Up @@ -77,15 +77,14 @@ sub cookies {

sub query_parameters {
my $self = shift;
$self->env->{'plack.request.query'} ||= $self->_parse_query;
}

my $env = $self->env;
my $query = $env->{'plack.request.query'};
if ($query) {
return $query;
}
sub _parse_query {
my $self = shift;

my @query;
my $query_string = $env->{QUERY_STRING};
my $query_string = $self->env->{QUERY_STRING};
if (defined $query_string) {
if ($query_string =~ /=/) {
# Handle ?foo=bar&bar=foo type of query
Expand All @@ -100,7 +99,8 @@ sub query_parameters {
split(/\+/, $query_string, -1);
}
}
$env->{'plack.request.query'} = Hash::MultiValue->new(@query);

Hash::MultiValue->new(@query);
}

sub content {
Expand Down

0 comments on commit 5413ff1

Please sign in to comment.