NAME

Azure::SDK::Core::Request - HTTP request value object for the Perl Azure SDK core

SYNOPSIS

use Azure::SDK::Core::Request;

my $request = Azure::SDK::Core::Request->new(
    method  => 'get',
    url     => 'https://example.blob.core.windows.net/container',
    headers => { 'x-ms-version' => '2025-01-05' },
);

$request->set_header('Authorization', 'Bearer ...');
my $auth = $request->header('authorization');

DESCRIPTION

Azure::SDK::Core::Request is a small core class object that holds the pieces of an outbound HTTP request. Generated service clients build a request and hand it to the pipeline; they never talk to the transport directly.

Header lookups and mutations are case-insensitive: header names are stored and matched in lower case.

CONSTRUCTOR

new

Named parameters:

method

Required. The HTTP method. Normalized to upper case. Must contain only letters (A-Z after normalization); a method containing digits, punctuation, or control characters (for example embedded CR/LF) causes the constructor to croak.

url

Required. The absolute request URL. Must not contain control characters (\x00-\x20 or \x7f, including CR/LF); such a url causes the constructor to croak.

headers

Optional hashref of request headers. Defaults to an empty hashref.

body

Optional request body. Defaults to undef.

METHODS

my $value = $request->header($name);

Returns the header value for $name, matched case-insensitively.

set_header

$request->set_header($name, $value);

Sets a header value and returns the request for chaining.

set_url

$request->set_url($url);

Replaces the request URL and returns the request for chaining. Credentials that authenticate via query string (for example SAS) use this. Rejects (croak) a $url containing control characters (\x00-\x20 or \x7f, including CR/LF).

with_body

$request->with_body($body);

Replaces the request body and returns the request for chaining.

SEE ALSO

Azure::SDK::Core::Response, Azure::SDK::Core::Pipeline