WWW::OAuth::Request::Mojo(3pm)

WWW::OAuth::Request::Mojo3pm

Http request container for mojo::message::request

Usage

 my $req = WWW::OAuth::Request::Mojo->new(request => $mojo_request);
 my $ua = Mojo::UserAgent->new;
 my $tx = $req->request_with($ua);
 $req->request_with_p($ua)->then(sub {
   my $tx = shift;
 });

Overview

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".

header

 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($ua);
 $req->request_with($ua, 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.

request_with_p

 my $p = $req->request_with_p($ua)->then(sub {
   my $tx = shift;
   ...
 });

Run non-blocking request with passed Mojo::UserAgent user-agent object, and return a Mojo::Promise which will be resolved with the successful transaction or rejected on a connection error, as in "start_p" in Mojo::UserAgent.

url

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

Set or return request URL from "request".

Releases

4 releases since Debian 10 (Buster); the text changed 3 times.

  1. 10
  2. 11
  3. 12
  4. 13

Bugs

Report any issues on the public bugtracker.

Author

Dan Book <[email protected]>

From libwww-oauth-perl 1.002-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.