Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Query Parameters Are Duplicated #174

wants to merge 1 commit into from

2 participants


The query parameters in GET requests are being duplicated. For example, the URL:

generates a parameter hash that looks like this:

a => ['foo', 'foo'],
b => ['bar', 'bar'],

The root of the problem seems to be that Mojo::Parameters::parse doesn't clear _string before parsing the input string. As a result, _string is parsed and the new query parameters are added to it instead of replacing it.


This does not appear to be true.

perl -Mojo -E'a("/" => sub { $_[0]->render_text($_[0]->dumper($_[0]->req->url->query->to_hash)) })->start' get '/?a=foo&b=bar'

You also seem to have forgotten unit tests.

@kraih kraih closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 27, 2011
  1. @dmw397
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/Mojo/
3  lib/Mojo/
@@ -87,9 +87,10 @@ sub params {
sub parse {
my ($self, $string) = @_;
- $string = delete $self->{_string} unless defined $string;
+ $string = $self->{_string} unless defined $string;
# Clear
+ delete $self->{_string};
# Detect pair separator for reconstruction
Something went wrong with that request. Please try again.