DOKK / manpages / debian 10 / libwww-oauth-perl / WWW::OAuth::Request::Mojo.3pm.en
WWW::OAuth::Request::Mojo(3pm) User Contributed Perl Documentation WWW::OAuth::Request::Mojo(3pm)

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

 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;
 });

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.

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

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

Mojo::Message::Request object to authenticate.

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

 my $pairs = $req->body_pairs;

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

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

Set or return request content from "request".

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

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

Set or return request method from "request".

 my $pairs = $req->query_pairs;

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

 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.

 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.

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

Set or return request URL from "request".

Report any issues on the public bugtracker.

Dan Book <dbook@cpan.org>

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

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

Mojo::UserAgent

2018-12-19 perl v5.28.1