NAME

Uniform::HTTP::Response - Framework-neutral HTTP response

SYNOPSIS

use Uniform::HTTP::Response;

my $response = Uniform::HTTP::Response->new(
    status  => 201,
    reason  => 'Created',
    version => '1.1',
    headers => [ [ 'Content-Type', 'application/json' ] ],
    body    => '{}',
);

DESCRIPTION

Uniform::HTTP::Response adds status and optional reason-phrase semantics to Uniform::HTTP::Message. It does not send a response or represent output progress.

CONSTRUCTOR

new

Requires a named status argument. It accepts optional reason and the common version, headers, and body arguments. No reason phrase or HTTP version is synthesized.

METHODS

status

Returns an integer HTTP status from 100 through 599. Passing a valid status sets it and returns the response.

reason

Returns the reason phrase or undef when none was supplied. Passing a byte string sets it; passing undef clears it. Uniform does not synthesize standard phrases such as OK.

INHERITED METHODS

See Uniform::HTTP::Message for headers, body state, version, capability reporting, and mutation.

AUTHOR

Joshua S. Day <HAX@cpan.org>

LICENSE

This software is available under the MIT License.