|
NAMEWWW::OAuth::Request::Basic - HTTP Request container for HTTP::Tiny SYNOPSISmy $req = WWW::OAuth::Request::Basic->new(method => 'POST', url => $url, content => $content); $req->request_with(HTTP::Tiny->new); DESCRIPTIONWWW::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. ATTRIBUTESWWW::OAuth::Request::Basic implements the following attributes. content my $content = $req->content;
$req = $req->content('foo=1&bar=2');
Request content string. headers 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. method my $method = $req->method;
$req = $req->method('GET');
Request method. url my $url = $req->url;
$req = $req->url('http://example.com/api/');
Request URL. METHODSWWW::OAuth::Request::Basic composes all methods from WWW::OAuth::Request, and implements the following new ones. content_is_formmy $bool = $req->content_is_form; Check whether "headers" contains a "Content-Type" header set to "application/x-www-form-urlencoded". header my $header = $req->header('Content-Type');
$req = $req->header(Authorization => 'Basic foobar');
Set or return a request header in "headers". set_form $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);
request_withmy $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. BUGSReport any issues on the public bugtracker. AUTHORDan Book <dbook@cpan.org> COPYRIGHT AND LICENSEThis software is Copyright (c) 2015 by Dan Book. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) SEE ALSOHTTP::Tiny
|