File Coverage

File:lib/Yukki/Web/Request.pm
Coverage:100.0%

linestmtbrancondsubpodtimecode
1package Yukki::Web::Request;
2
3
3
3
18
6
use v5.24;
4
3
3
3
10
3
12
use utf8;
5
3
3
3
29
3
11
use Moo;
6
7
3
3
3
1109
67275
50
use Plack::Request;
8
3
3
3
14
3
18
use Type::Utils;
9
3
3
3
2716
6
15
use Types::Standard qw( HashRef );
10
11
3
3
3
1831
8954
12
use namespace::clean;
12
13# ABSTRACT: Yukki request descriptor
14
15 - 25
=head1 DESCRIPTION

This is an abstraction that looks astonishingly similar to L<Plack::Request>.

=head1 ATTRIBUTES

=head2 env

This is the PSGI environment. Do not use.

=cut
26
27has env => (
28    is          => 'ro',
29    isa         => HashRef,
30    required    => 1,
31);
32
33 - 43
=head2 request

This is the internal L<Plack::Request> object. Do not use. Use one of the methods delegated to it instead:

  address remote_host method protocol request_uri path_info path script_name scheme
  secure body input session session_options logger cookies query_parameters
  body_parameters parameters content raw_body uri base user headers uploads
  content_encoding content_length content_type header referer user_agent param
  upload

=cut
44
45has request => (
46    is          => 'ro',
47    isa         => class_type('Plack::Request'),
48    required    => 1,
49    lazy        => 1,
50    builder     => '_build_request',
51    handles     => [ qw(
52        address remote_host method protocol request_uri path_info path script_name scheme
53        secure body input session session_options logger cookies query_parameters
54        body_parameters parameters content raw_body uri base user headers uploads
55        content_encoding content_length content_type header referer user_agent param
56        upload
57    ) ],
58);
59
60sub _build_request {
61
4
469
    my $self = shift;
62
4
34
    return Plack::Request->new($self->env);
63}
64
65 - 69
=head2 path_parameters

These are the variables found in the path during dispatch.

=cut
70
71has path_parameters => (
72    is          => 'rw',
73    isa         => HashRef,
74    required    => 1,
75    default     => sub { +{} },
76);
77
781;