NAME

Uniform::HTTP::Request - Framework-neutral HTTP request

SYNOPSIS

use Uniform::HTTP::Request;

my $request = Uniform::HTTP::Request->new(
    method  => 'POST',
    target  => '/items?draft=1',
    version => '1.1',
    headers => [ [ 'Content-Type', 'application/json' ] ],
    body    => '{"name":"example"}',
);

DESCRIPTION

Uniform::HTTP::Request adds method and request-target semantics to Uniform::HTTP::Message. It is a detached message object, not a transaction or connection.

CONSTRUCTOR

new

Requires named method and target arguments. It also accepts the common version, headers, and body arguments.

METHODS

method

Returns the case-sensitive HTTP method token. Passing a token sets it and returns the request.

target

Returns the HTTP request-target as bytes, not as a URI object. Passing a target sets it and returns the request.

target_is_exact

Returns true for canonical requests because target() is exactly the value supplied by the caller. An adapter returns false when it had to reconstruct a target from framework data.

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.