Connector

 view release on metacpan or  search on metacpan

lib/Connector/Proxy/HTTP.pm  view on Meta::CPAN

    my $response = shift;

    my $res = $response->decoded_content;
    chomp $res if ($self->chomp_result());
    return $res;
}


no Moose;
__PACKAGE__->meta->make_immutable;

1;

__END__

=head1 NAME

Connector::Proxy::HTTP

=head1 DESCRIPTION

Send or retrieve data from a defined URI using HTTP.

=head1 USAGE

=head2 minimal setup

  Connector::Proxy::HTTP->new({
    LOCATION => 'https://127.0.0.1/my/base/url',
  });

=head2 connection settings

See Connector::Role::SSLUserAgent for SSL and HTTP related settings

=head2 additional options

=over

=item file/path

The default behaviour is to append the list of given path arguments to
LOCATION as url path components "as is" by joining them with a slash.

If you set I<file> or I<path>, the value is taken as a template string,
rendered and appended to LOCATION. In this case the path arguments are
NOT appended to the location but the.
See Connector::Role::LocalPath for details on the template part.

=item query_param

A HashRef, the key/value pairs are appended to the URI as query string.
Any values are escaped using uri_escape, keys are taken as is.

=item header

A HashRef, the key/value pairs are set as HTTP headers.

=item http_auth

A HashRef with I<user> and I<pass> used as credentials to perform a
HTTP Basic Authentication.

=item chomp_result

When working with text documents the transport layer adds a trailing
newline which might be unhandy when working with scalar values. If
set to a true value, a trailing newline will be removed by calling C<chomp>.

=item undef_on_404

By default, the connector will die if a resource is not found. If set
to a true value the connector returns undef, note that die_on_undef
will be obeyed.

=back

=head2 Parameter used with set

=over

=item content

A template toolkit string to generate the payload, receives the payload
argument as HasRef in I<DATA>.

=item content_type

The Content-Type header to use, default is no header.

=item http_method

The http method to use, default is PUT.

=back

=head1 Result Handling

If you need to parse the result returned by get, inherit from the class
an implement I<_parse_result>. This method receives the response object
from the user agent call and must return a scalar value which is returned
to the caller.



( run in 1.179 second using v1.01-cache-2.11-cpan-39bf76dae61 )