Throwable/Role/Status/NotModified.pm

filter: Statementstmt 100% 23 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 93.5% 29 / 31 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
default_status_code
1.0
CRAP 1.0
« Throwable/Role/BoringText.pm ↑ Summary Throwable/Role/Status/MethodNotAllowed.pm »
1 package HTTP::Throwable::Role::Status::NotModified;
2 1 our $AUTHORITY = 'cpan:STEVAN';
3 1 $HTTP::Throwable::Role::Status::NotModified::VERSION = '0.027';
4 1 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Plack::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 with(
9 'HTTP::Throwable',
10 'HTTP::Throwable::Role::BoringText',
11 );
12  
13 2 ▶sub default_status_code { 304 }
Subroutine default_status_code: called CC=1 SCAR=0.0
Pod undocumented
14 2 ▶sub default_reason { 'Not Modified' }
Subroutine default_reason: called CC=1 SCAR=0.0
Pod undocumented
15  
16 around 'as_psgi' => sub {
17 2 ▶ my $next = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
18 2 my $self = shift;
19 2 my $psgi = $self->$next();
20  
21 # MUST NOT have a message body, see below
22 2 Plack::Util::header_set( $psgi->[1], 'Content-Length' => 0 );
23 2 Plack::Util::header_remove( $psgi->[1], 'Content-Type');
24  
25 2 $psgi->[2] = [];
26  
27 2 $psgi;
28 1 };
29  
30 1 ▶no Moo::Role; 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 =pod
33  
34 =encoding UTF-8
35  
36 =head1 NAME
37  
38 HTTP::Throwable::Role::Status::NotModified - 304 Not Modified
39  
40 =head1 VERSION
41  
42 version 0.027
43  
44 =head1 DESCRIPTION
45  
46 If the client has performed a conditional GET request and access
47 is allowed, but the document has not been modified, the server
48 SHOULD respond with this status code. The 304 response MUST NOT
49 contain a message-body, and thus is always terminated by the
50 first empty line after the header fields.
51  
52 The response MUST include the following header fields:
53  
54 =over 4
55  
56 =item Date, unless its omission is required by section 14.18.1
57  
58 If a clockless origin server obeys these rules, and proxies and
59 clients add their own Date to any response received without one
60 (as already specified by [RFC 2068], section 14.19), caches will
61 operate correctly.
62  
63 =item ETag and/or Content-Location, if the header would have been sent in a 200 response to the same request
64  
65 =item Expires, Cache-Control, and/or Vary, if the field-value might differ from that sent in any previous response for the same variant
66  
67 =back
68  
69 If the conditional GET used a strong cache validator, the response
70 SHOULD NOT include other entity-headers. Otherwise (i.e., the conditional
71 GET used a weak validator), the response MUST NOT include other
72 entity-headers; this prevents inconsistencies between cached
73 entity-bodies and updated headers.
74  
75 If a 304 response indicates an entity not currently cached, then
76 the cache MUST disregard the response and repeat the request without
77 the conditional.
78  
79 If a cache uses a received 304 response to update a cache entry,
80 the cache MUST update the entry to reflect any new field values
81 given in the response.
82  
83 =head1 AUTHORS
84  
85 =over 4
86  
87 =item *
88  
89 Stevan Little <stevan.little@iinteractive.com>
90  
91 =item *
92  
93 Ricardo Signes <rjbs@cpan.org>
94  
95 =back
96  
97 =head1 COPYRIGHT AND LICENSE
98  
99 This software is copyright (c) 2011 by Infinity Interactive, Inc.
100  
101 This is free software; you can redistribute it and/or modify it under
102 the same terms as the Perl 5 programming language system itself.
103  
104 =cut
105  
106 __END__
« Throwable/Role/BoringText.pm ↑ Summary Throwable/Role/Status/MethodNotAllowed.pm »