WWW::OAuth::Request::Basic(3pm) | User Contributed Perl Documentation | WWW::OAuth::Request::Basic(3pm) |
WWW::OAuth::Request::Basic - HTTP Request container for HTTP::Tiny
my $req = WWW::OAuth::Request::Basic->new(method => 'POST', url => $url, content => $content); $req->request_with(HTTP::Tiny->new);
WWW::OAuth::Request::Basic is a request container for WWW::OAuth that stores the request parameters directly, for use with user-agents that do not use request objects like HTTP::Tiny. It performs the role WWW::OAuth::Request.
WWW::OAuth::Request::Basic implements the following attributes.
my $content = $req->content; $req = $req->content('foo=1&bar=2');
Request content string.
my $headers = $req->headers; $req = $req->headers({});
Hashref of request headers. Must be updated carefully as headers are case-insensitive. Values can be array references to specify multi-value headers.
my $method = $req->method; $req = $req->method('GET');
Request method.
my $url = $req->url; $req = $req->url('http://example.com/api/');
Request URL.
WWW::OAuth::Request::Basic composes all methods from WWW::OAuth::Request, and implements the following new ones.
my $bool = $req->content_is_form;
Check whether "headers" contains a "Content-Type" header set to "application/x-www-form-urlencoded".
my $header = $req->header('Content-Type'); $req = $req->header(Authorization => 'Basic foobar');
Set or return a request header in "headers".
$req = $req->set_form({foo => 'bar'});
Convenience method to set "content" to a urlencoded form. Equivalent to:
use WWW::OAuth::Util 'form_urlencode'; $req->header('Content-Type' => 'application/x-www-form-urlencoded'); $req->content(form_urlencode $form);
my $res = $req->request_with(HTTP::Tiny->new);
Run request with passed HTTP::Tiny user-agent object, and return response hashref, as in "request" in HTTP::Tiny.
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)
HTTP::Tiny
2022-12-06 | perl v5.36.0 |