summaryrefslogtreecommitdiffstats
path: root/lib/Web/Response.pm
blob: 970f3221b5797954c6b4005022d751d160a0a3e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package Web::Response;
use Moose;

use HTTP::Headers;

use Web::Response::Types ();

has status => (
    is      => 'rw',
    isa     => 'Web::Response::Types::HTTPStatus',
    lazy    => 1,
    default => sub { confess "Status was not supplied" },
);

has headers => (
    is      => 'rw',
    isa     => 'Web::Response::Types::HTTP::Headers',
    lazy    => 1,
    coerce  => 1,
    default => sub { HTTP::Headers->new },
    handles => {
        header           => 'header',
        content_length   => 'content_length',
        content_type     => 'content_type',
        content_encoding => 'content_encoding',
        location         => [ header => 'Location' ],
    },
);

has body => (
    is      => 'rw',
    isa     => 'Web::Response::Types::PSGIBody',
    lazy    => 1,
    coerce  => 1,
    default => sub { [] },
);

has cookies => (
    is      => 'ro',
    isa     => 'HashRef',
    lazy    => 1,
    default => sub { +{} },
);

sub redirect {
    ...
}

sub finalize {
    ...
}

__PACKAGE__->meta->make_immutable;
no Moose;

1;