NAME
HTTP::Body::Builder::UrlEncoded - application/x-www-encoded
SYNOPSIS
use HTTP::Body::Builder::UrlEncoded;
my $builder = HTTP::Body::Builder::UrlEncoded->new(content => {'foo' => 42});
$builder->add_content('x' => 'y');
$builder->as_string;
# => x=y
METHODS
- my $builder = HTTP::Body::Builder::UrlEncoded->new(...)
-
Create a new HTTP::Body::Builder::UrlEncoded instance.
The constructor accepts named arguments as a hash. The only allowed parameter is
content
. This parameter should be a hashref.Each key/value pair in this hashref will be added to the builder by calling the
add_content
method.If the value of one of the content hashref's keys is an arrayref, then each member of the arrayref will be added separately.
HTTP::Body::Builder::UrlEncoded->new(content => {'a' => 42, 'b' => [1, 2]});
is equivalent to the following:
my $builder = HTTP::Body::Builder::UrlEncoded->new; $builder->add_content('a' => 42); $builder->add_content('b' => 1); $builder->add_content('b' => 2);
- $builder->add_content($key => $value);
-
Add new parameter in raw string.
- $builder->as_string();
-
Generate body as string.