Permalink
Browse files

Cleanup request query caching #384

  • Loading branch information...
miyagawa committed Mar 8, 2013
1 parent a31f876 commit 5413ff13c8ba33c29e682d521c586e16c18a7822
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/Plack/Request.pm
View
@@ -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
@@ -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 {

0 comments on commit 5413ff1

Please sign in to comment.