NAME

WWW::OAuth::Request::HTTP_Request - HTTP Request container for HTTP::Request

SYNOPSIS

my $req = WWW::OAuth::Request::HTTP_Request->new(request => $http_request);
$req->request_with(LWP::UserAgent->new);

DESCRIPTION

WWW::OAuth::Request::HTTP_Request is a request container for WWW::OAuth that wraps a HTTP::Request object, which can be used by several user-agents like LWP::UserAgent, HTTP::Thin, and Net::Async::HTTP. It performs the role WWW::OAuth::Request.

ATTRIBUTES

WWW::OAuth::Request::HTTP_Request implements the following attributes.

request

my $http_request = $req->request;
$req             = $req->request(HTTP::Request->new(GET => $url));

HTTP::Request object to authenticate.

METHODS

WWW::OAuth::Request::HTTP_Request composes all methods from WWW::OAuth::Request, and implements the following new ones.

content

my $content = $req->content;
$req        = $req->content('foo=1&bar=2');

Set or return request content from "request".

content_is_form

my $bool = $req->content_is_form;

Check whether "request" has single-part content and a Content-Type header of application/x-www-form-urlencoded.

my $header = $req->header('Content-Type');
$req       = $req->header(Authorization => 'Basic foobar');

Set or return a request header from "request".

method

my $method = $req->method;
$req       = $req->method('GET');

Set or return request method from "request".

request_with

$http_response = $req->request_with(LWP::UserAgent->new);

Run request with passed user-agent object, and return HTTP::Response object. User-agent may be LWP::UserAgent, HTTP::Thin, or Net::Async::HTTP. If run with Net::Async::HTTP, the return value is a Future yielding the HTTP::Response object as in "do_request" in Net::Async::HTTP.

url

my $url = $req->url;
$req    = $req->url('http://example.com/api/');

Set or return request URL from "request".

BUGS

Report any issues on the public bugtracker.

AUTHOR

Dan Book <dbook@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Dan Book.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

SEE ALSO

LWP::UserAgent, HTTP::Thin, Net::Async::HTTP