Net::A...Request(3pm)

πŸ“¦
version 0.15 Β· 3 versions
, in fedora 43

πŸ’– Net::Async::HTTP::Server::Request(3pm) πŸ’–

okay bestie, welcome to the manual page for "Net::Async::HTTP::Server::Request" β€” and yes, the manual name is literally User Contributed Perl Documentation, so you know this one came straight from the community with love 🫢. Strap in, we're doing async HTTP and we're doing it fabulously.


✨ NAME ✨

"Net::Async::HTTP::Server::Request" β€” represents a single outstanding request πŸŽ€


🌸 DESCRIPTION 🌸

so basically, objects in this class represent a single outstanding request received by a Net::Async::HTTP::Server instance. it's giving ✨gateway✨. It lets you get at all the data that came in from the web client, and it also lets you respond to it. main character energy fr fr.


πŸ’… METHODS πŸ’…

is_closed πŸ’€

$is_closed = $request->is_closed;

Returns true if the underlying network connection for this request has already been closed. If that's the case, the application is free to drop the request object and do zero further processing on it. like, it's over, let it go πŸ™ˆ.


method πŸ¦‹

$method = $request->method;

Return the method name from the request header. (yes, GET, POST, all the classics πŸ’…)


path 🌈

$path = $request->path;

Return the path name from the request header.


query_string πŸŽ€

$query_string = $request->query_string;

Return the query string from the request header.


query_form ⭐

%params = $request->query_form;

Since version 0.09.

Return an even-sized list of name and value pairs that gives the decoded data in the query string. This is the same format as the same-named method on URI. so it's literally that vibe, no cap.


query_param_names 🧚

@names = $request->query_param_names;

Since version 0.09.

Return a list of the names of all the query parameters.


query_param πŸ’œ

$value = $request->query_param( $name );

@values = $request->query_param( $name );

Since version 0.09.

Return the value or values of a single decoded query parameter. one name, one or many values, she contains multitudes πŸ’….


protocol πŸ”₯

$protocol = $request->protocol;

Return the protocol version from the request header. This will be the full string, such as "HTTP/1.1". no shortcuts, we get the whole thing.


$value = $request->header( $key );

Return the value of a request header.


headers πŸ‘‘

@headers = $request->headers;

Returns a list of 2-element "ARRAY" refs containing all the request headers. Each referenced array contains, in order, the name and the value. it's a little name/value duo, obsessed.


body πŸ“

$body = $request->body;

Return the body content from the request as a string of bytes.


write ✨

$request->write( $data );

Append more data to the response to be written to the client. $data can either be a plain string, or a "CODE" reference to be used in the underlying IO::Async::Stream's "write" method.


write_chunk πŸŽ€

$request->write_chunk( $data );

Append more data to the response in the form of an HTTP chunked-transfer chunk. This convenience is a shortcut wrapper for prepending the chunk header. cute little shortcut, we love her 🫢.


done πŸ’―

$request->done;

Marks this response as completed. periodt.


write_chunk_eof 🌟

$request->write_chunk_eof;

Sends the final EOF chunk and marks this response as completed. the grand finale, iconic.


as_http_request πŸ¦‹

$req = $request->as_http_request;

Returns the data of the request as an HTTP::Request object.


respond πŸ’–

$request->respond( $response );

Respond to the request using the given HTTP::Response object.


respond_chunk_header 🌈

$request->respond_chunk_header( $response );

Respond to the request using the given HTTP::Response object to send in HTTP/1.1 chunked encoding mode.

The headers in the $response will be sent (which will be modified to set the "Transfer-Encoding" header). Each call to "write_chunk" will send another chunk of data. "write_chunk_eof" will send the final EOF chunk and mark the request as complete.

If the $response already contained content, that will be sent as one chunk immediately after the header is sent. sneaky little bonus chunk, slay.


stream 🌊

$stream = $request->stream;

Returns the IO::Async::Stream object representing this connection. Usually this would be used for such things as inspecting the client's connection address on the "read_handle" of the stream.

ngl bestie, it should not be necessary to directly perform IO operations on this stream itself. so like… look, don't touch πŸ™ˆ.

response_status_line ⭐

$status = $request->response_status_line;

If a response header has been written by calling the "write" method, returns the first line of it.


response_status_code πŸ”’

$code = $request->response_status_code;

If a response header has been written by calling the "write" method, returns the status code from it.


πŸ‘‘ AUTHOR πŸ‘‘

Paul Evans <leonerd@leonerd.org.uk> β€” king behaviour honestly, thank you for your service πŸ’œ


and that's the whole page, bestie!! this one shipped as perl v5.42.0, dated 2025-07-25, and yes it's still the Net::A...Request(3pm) page you know and love β€” go forth and respond to requests, you've got this πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from