# This little bit of heaven handles appending a new value onto
# an existing one regardless if the existing value is an array
# or not, and regardless if the new value is an array or not
$params{$key} = [
ref( $params{$key} ) eq 'ARRAY'
? @{ $params{$key} }
: $params{$key},
ref($val) eq 'ARRAY'? @{$val} : $val
];
}
else{
$params{$key} = $val;
}
}
else{
# If the param wasn't defined then we delete it.
delete( $params{$key} );
}
}
\%params;
};
my$uri= $self->uri->clone;
$uri->query_form($params);
return$uri;
}
1;
__END__
=encoding utf-8
=head1 NAME
Amon2::Web::Request - Amon2 Request Class
=head1 DESCRIPTION
This is a child class of L<Plack::Request>. Please see L<Plack::Request> for more details.
=head1 AUTOMATIC DECODING
This class decode query/body parameters automatically.
Return value of C<< $req->param() >>, C<< $req->body_parameters >>, etc. is the decoded value.
=head1 METHODS
=over 4
=item $req->uri_with($args, $behavior)
Returns a rewritten URI object for the current request. Key/value pairs passed in will override existing parameters. You can remove an existing parameter by passing in an undef value. Unmodified pairs will be preserved.
You may also pass an optional second parameter that puts uri_with into append mode: