logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

WWW::OAuth::Request::Basic - HTTP Request container for HTTP::Tiny

Attributes

       WWW::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.

Author

       Dan Book <dbook@cpan.org>

Bugs

       Report any issues on the public bugtracker.

Description

       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.

Methods

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

   content_is_form
        my $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_with
        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.

Name

       WWW::OAuth::Request::Basic - HTTP Request container for HTTP::Tiny

See Also

       HTTP::Tiny

perl v5.40.1                                       2025-08-10                    WWW::OAuth::Request::Basic(3pm)

Synopsis

        my $req = WWW::OAuth::Request::Basic->new(method => 'POST', url => $url, content => $content);
        $req->request_with(HTTP::Tiny->new);

See Also