}
{
- my @non_data_methods = qw(GET DELETE OPTIONS);
+ my @non_data_methods = qw(HEAD GET DELETE OPTIONS);
foreach my $method (@non_data_methods) {
no strict 'refs';
my $sub = lc($method);
*$sub = sub {
my $self = shift;
- my %p = validate( @_, { url => { type => SCALAR }, }, );
+ my %p = validate(
+ @_,
+ {
+ url => { type => SCALAR },
+ headers => { type => HASHREF, default => {} },
+ },
+ );
my $req = HTTP::Request->new( "$method" => $p{'url'} );
+ $req->header( $_ => $p{headers}{$_} ) for keys %{ $p{headers} };
$req->content_type( $self->{'content_type'} );
return $req;
};
{
url => { type => SCALAR },
data => 1,
+ headers => { type => HASHREF, default => {} },
},
);
my $req = HTTP::Request->new( "$method" => $p{'url'} );
+ $req->header( $_ => $p{headers}{$_} ) for keys %{ $p{headers} };
$req->content_type( $self->{'content_type'} );
$req->content_length(
do { use bytes; length( $p{'data'} ) }