WWW::O...Request(3pm)

πŸ“¦
version 1.003 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

✨ WWW::OAuth::Request β€” bestie edition πŸ’–

okay so this is the WWW::OAuth::Request page from the User Contributed Perl Documentation, and she is an HTTP Request container role and she is iconic. sit down, grab a strawberry πŸ“, we're doing this.


🌸 NAME 🌸

WWW::OAuth::Request β€” HTTP Request container role. that's her. that's the whole name. short, sweet, main character energy πŸ‘‘


✨ SYNOPSIS ✨

like, here's the vibe check:

use Role::Tiny::With;
with 'WWW::OAuth::Request';

that's it. you with it and suddenly you're a request container. slay.


πŸ’… DESCRIPTION πŸ’…

okay so WWW::OAuth::Request is a Role::Tiny role, right, and what she does is give WWW::OAuth a consistent interface for parsing and authenticating requests. no cap. if you want the specifics β€” the actual gritty details of what a request container needs to be β€” go look at "HTTP REQUEST CONTAINERS" in WWW::OAuth. she's not gonna repeat herself here, periodt.


πŸ¦‹ METHODS πŸ¦‹

WWW::OAuth::Request implements or requires the following methods. yes, "or requires" β€” some of these are homework you have to do yourself, bestie, and she will absolutely let you know which ones. πŸ™ˆ


πŸŽ€ body_pairs

my $pairs = $req->body_pairs;

returns the body parameters out of "application/x-www-form-urlencoded" "content" β€” and it hands them back as an even-sized arrayref of keys and values. so like key, value, key, value, alternating forever. it's giving very organized. πŸ’–


πŸŽ€ content

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

sets or returns the request content. that's it, that's the method. but here's the thing β€” you must implement this one for the role to compose. it's a requirement, not a suggestion. πŸ”₯


πŸŽ€ content_is_form

my $bool = $req->content_is_form;

checks whether the content is single-part and the content type is "application/x-www-form-urlencoded". returns a bool. also must be implemented to compose the role β€” so yeah, another one you're on the hook for. 🫢


my $header = $req->header('Content-Type');
$req       = $req->header('Content-Type' => 'application/x-www-form-urlencoded');

sets or returns a request header. you can set multiple values by passing an array reference as the value β€” and when you ask for multi-value headers back, they get joined on ", ". cute little comma-space moment. also: must be implemented to compose the role. ✨


πŸŽ€ method

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

sets or returns the request method. GET, POST, whatever you're feeling. must be implemented to compose the role. πŸ’œ


πŸŽ€ query_pairs

my $pairs = $req->query_pairs;

returns the query parameters from "url" as an even-sized arrayref of keys and values. same alternating key-value energy as body_pairs but for the URL. consistency?? we love her. 🧚


πŸŽ€ request_with

my $res = $req->request_with($ua);

sends the request using the passed user-agent object and returns the response. must be implemented to compose the role. yes bestie, this is the one that actually does the thing. πŸ’…


πŸŽ€ url

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

sets or returns the request URL. must be implemented to compose the role. and that's the last required one β€” you made it. πŸŽ‰


😭 BUGS 😭

report any issues on the public bugtracker. please don't suffer in silence, that's not the vibe. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Dan Book <dbook@cpan.org> β€” actual legend.


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

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

free software?? we love to see it. πŸŽ€


⭐ SEE ALSO ⭐

  • HTTP::Request
  • Mojo::Message::Request

go read those too, iykyk. πŸ“š


and that's the whole page, bestie πŸ’– this was WWW::O...Request(3pm) from perl v5.40.1, dated 2025-08-10. thanks for reading, you ate that. periodt. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from