NAME

Azure::SDK::Core::Response - HTTP response value object for the Perl Azure SDK core

SYNOPSIS

if ($response->is_success) {
    my $data = $response->decoded_json;
}

DESCRIPTION

Azure::SDK::Core::Response is a small core class object returned by the transport and pipeline. It exposes the status code, response headers, and the raw body, plus a couple of convenience helpers.

Header lookups are case-insensitive.

CONSTRUCTOR

new

Named parameters:

status

Required. The numeric HTTP status code.

headers

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

body

Optional raw response body. Defaults to undef.

METHODS

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

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

is_success

Returns true when the status code is in the 2xx range.

decoded_json

Decodes the body as UTF-8 JSON and returns the resulting data structure, or undef when the body is empty. Throws if the body is not valid JSON.

SEE ALSO

Azure::SDK::Core::Request, Azure::SDK::Core::Error