NAME

WWW::OAuth::Request::Mojo - HTTP Request container for Mojo::Message::Request

SYNOPSIS

my $req = WWW::OAuth::Request::Mojo->new(request => $mojo_request);
my $tx = $req->request_with(Mojo::UserAgent->new);

DESCRIPTION

WWW::OAuth::Request::Mojo is a request container for WWW::OAuth that wraps a Mojo::Message::Request object, which is used by Mojo::UserAgent. It performs the role WWW::OAuth::Request.

ATTRIBUTES

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

request

my $mojo_request = $req->request;
$req             = $req->request($mojo_request);

Mojo::Message::Request object to authenticate.

METHODS

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

body_pairs

my $pairs = $req->body_pairs;

Return body parameters from "request" as an even-sized arrayref of keys and values.

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 => 'foo bar');

Set or return a request header from "request".

method

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

Set or return request method from "request".

query_pairs

my $pairs = $req->query_pairs;

Return query parameters from "request" as an even-sized arrayref of keys and values.

request_with

my $tx = $req->request_with(Mojo::UserAgent->new);
$req->request_with(Mojo::UserAgent->new, sub {
  my ($ua, $tx) = @_;
  ...
});

Run request with passed Mojo::UserAgent user-agent object, and return Mojo::Transaction object, as in "start" in Mojo::UserAgent. A callback can be passed to perform the request non-blocking.

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

Mojo::UserAgent