Skip to content

Commit

Permalink
mention the specs
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 22, 2015
1 parent b46e359 commit 7de701b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/Parameters.pm
Expand Up @@ -151,14 +151,14 @@ sub to_hash {
sub to_string {
my $self = shift;

# String
# String (RFC 3986)
my $charset = $self->charset;
if (defined(my $str = $self->{string})) {
$str = encode $charset, $str if $charset;
return url_escape $str, '^A-Za-z0-9\-._~%!$&\'()*+,;=:@/?';
}

# Build pairs
# Build pairs (HTML Living Standard)
my $pairs = $self->pairs;
return '' unless @$pairs;
my @pairs;
Expand Down
4 changes: 2 additions & 2 deletions t/mojo/parameters.t
Expand Up @@ -111,8 +111,8 @@ is_deeply $params->to_hash, {c => '', d => 0, e => ''}, 'right structure';
$params = Mojo::Parameters->new('foo=%2B');
is $params->param('foo'), '+', 'right value';
is_deeply $params->to_hash, {foo => '+'}, 'right structure';
$params->param('foo ' => 'a');
is $params->to_string, 'foo=%2B&foo+=a', 'right format';
$params->param('foo ' => ' bar');
is $params->to_string, 'foo=%2B&foo+=+bar', 'right format';
$params->remove('foo ');
is_deeply $params->to_hash, {foo => '+'}, 'right structure';
$params->append('1 2', '3+3');
Expand Down

0 comments on commit 7de701b

Please sign in to comment.