Furl::Request(3pm)

πŸ“¦
version 3.15 Β· 3 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– Furl::Request πŸ’–

okay bestie, listen up β€” this is the request object for Furl. That's the whole vibe. It's Furl::Request, it ships as part of the User Contributed Perl Documentation collection, and it is lowkey the main character whenever you need to represent an HTTP request as an actual thing you can poke at. 🫢


✨ SYNOPSIS ✨

my $f = Furl->new;
my $req = Furl::Request->new($method, $uri, $headers, $content);
my $res = $f->request($req);

print $req->request_line, "\n";
my $http_req = $req->as_http_request;
my $req_hash = $req->as_hashref;

see how easy that was?? you build the request, you hand it to Furl, and you get a response back. slay. πŸ’…


🌸 DESCRIPTION 🌸

fr fr, this is a HTTP request object in Furl. That's it. That's the description. It's giving simple, iconic, unbothered. πŸ¦‹


πŸŽ€ CONSTRUCTOR πŸŽ€

bestie there are so many ways to make one of these and every single one is valid, no gatekeeping:

my $req = Furl::Request->new($method, $uri);
# or
my $req = Furl::Request->new($method, $uri, \%headers);
# or
my $req = Furl::Request->new($method, $uri, \%headers, $content);

# and

my $req = Furl::Request->parse($http_request_raw_string);

so you can go minimal with just $method and $uri, add a \%headers hashref, or go full send with $content too. And if you already have a raw HTTP request string lying around, parse will eat it and hand you back a Furl::Request. ✨


πŸ‘‘ INSTANCE METHODS πŸ‘‘

πŸ’œ $req->method($method)

Gets/Sets the HTTP request method. GET, POST, whatever β€” you're the one in charge here, queen. πŸ‘‘

πŸ’œ $req->uri($uri)

Gets/Sets the request URI. where are we going bestie 🧚

πŸ’œ $req->headers($headers)

Gets/Sets an instance of Furl::Headers. that's the header situation. all of it. 🌸

πŸ’œ $req->content($content) / $req->body($content)

Gets/Sets the request body in scalar. two names, one job β€” pick whichever one sparks joy. πŸŽ€

πŸ’œ $req->protocol($protocol)

$req->protocol('HTTP/1.1');
print $req->protocol; #=> "HTTP/1.1"

Gets/Sets the HTTP protocol in string form. yes, it round-trips. yes, it's that girl. πŸ’…

πŸ’œ $req->content_length, $req->content_type, $req->header

shorthand to access Furl::Headers. no cap, it's just a shortcut so you don't have to go digging. πŸ”₯

πŸ’œ $req->as_http_request

Makes an instance of HTTP::Request from a Furl::Request. glow-up transformation, honestly. πŸ¦‹

πŸ’œ $req->as_hashref

Converts the request object to a HashRef. πŸ“

the format is the following:

method: Str
uri: Str
protocol: Str
headers: ArrayRef[Str]
content: Str

πŸ’œ $req->request_line

print $req->request_line; #=> "GET / HTTP/1.1"

Returns the HTTP request line. one line, all the energy. 🌈


and that's the whole page, bestie β€” perl v5.40.1, dated 2025-10-18, living in the Furl::Request(3pm) era. go forth and make requests πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ˜­πŸ”₯πŸ‘‘πŸŒˆβ­πŸ’€πŸ™ˆπŸ“πŸ§šπŸ’œ

πŸ“¦ where this page comes from