Skip to content

Commit c43a3cf

Browse files
Theo van Hoeseloalders
authored andcommitted
add is_cacheable_by_default
1 parent 4846a23 commit c43a3cf

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/HTTP/Status.pm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ sub is_redirect ($) { $_[0] && $_[0] >= 300 && $_[0] < 400; }
111111
sub is_error ($) { $_[0] && $_[0] >= 400 && $_[0] < 600; }
112112
sub is_client_error ($) { $_[0] && $_[0] >= 400 && $_[0] < 500; }
113113
sub is_server_error ($) { $_[0] && $_[0] >= 500 && $_[0] < 600; }
114+
sub is_cacheable_by_default ($) { $_[0] &&
115+
( $_[0] == 200 # OK
116+
|| $_[0] == 203 # Non-Authoritative Information
117+
|| $_[0] == 204 # No Content
118+
|| $_[0] == 206 # Not Acceptable
119+
|| $_[0] == 300 # Multiple Choices
120+
|| $_[0] == 301 # Moved Permanently
121+
|| $_[0] == 404 # Not Found
122+
|| $_[0] == 405 # Method Not Allowed
123+
|| $_[0] == 410 # Gone
124+
|| $_[0] == 414 # Request-URI Too Large
125+
|| $_[0] == 501 # Not Implemented
126+
); }
114127
1;
115128

116129

0 commit comments

Comments
 (0)