« Throwable/Role/Status/PreconditionFailed.pm
↑ Summary
Throwable/Role/Status/RequestURITooLong.pm »
| 1 | package HTTP::Throwable::Role::Status::RequestEntityTooLarge 0.028; | ||
| 2 | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 3 | |||
| 4 | use Types::Standard qw(Str); | ||
| 5 | |||
| 6 | use Moo::Role; | ||
| 7 | |||
| 8 | with( | ||
| 9 | 'HTTP::Throwable', | ||
| 10 | 'HTTP::Throwable::Role::BoringText', | ||
| 11 | ); | ||
| 12 | |||
| 13 | sub default_status_code { 413 } | ||
| 14 | sub default_reason { 'Request Entity Too Large' } | ||
| 15 | |||
| 16 | has 'retry_after' => ( is => 'ro', isa => Str ); | ||
| 17 | |||
| 18 | around 'build_headers' => sub { | ||
| 19 | my $next = shift; | ||
| 20 | my $self = shift; | ||
| 21 | my $headers = $self->$next( @_ ); | ||
| 22 | if ( my $retry = $self->retry_after ) { | ||
| 23 | push @$headers => ('Retry-After' => $retry); | ||
| 24 | } | ||
| 25 | $headers; | ||
| 26 | }; | ||
| 27 | |||
| 28 | no Moo::Role; 1; | ||
| 29 | |||
| 30 | =pod | ||
| 31 | |||
| 32 | =encoding UTF-8 | ||
| 33 | |||
| 34 | =head1 NAME | ||
| 35 | |||
| 36 | HTTP::Throwable::Role::Status::RequestEntityTooLarge - 413 Request Entity Too Large | ||
| 37 | |||
| 38 | =head1 VERSION | ||
| 39 | |||
| 40 | version 0.028 | ||
| 41 | |||
| 42 | =head1 DESCRIPTION | ||
| 43 | |||
| 44 | The server is refusing to process a request because the request | ||
| 45 | entity is larger than the server is willing or able to process. | ||
| 46 | The server MAY close the connection to prevent the client from | ||
| 47 | continuing the request. | ||
| 48 | |||
| 49 | If the condition is temporary, the server SHOULD include a | ||
| 50 | Retry-After header field to indicate that it is temporary and | ||
| 51 | after what time the client MAY try again. | ||
| 52 | |||
| 53 | =head1 PERL VERSION | ||
| 54 | |||
| 55 | This library should run on perls released even a long time ago. It should work | ||
| 56 | on any version of perl released in the last five years. | ||
| 57 | |||
| 58 | Although it may work on older versions of perl, no guarantee is made that the | ||
| 59 | minimum required version will not be increased. The version may be increased | ||
| 60 | for any reason, and there is no promise that patches will be accepted to lower | ||
| 61 | the minimum required perl. | ||
| 62 | |||
| 63 | =head1 ATTRIBUTES | ||
| 64 | |||
| 65 | =head2 retry_after | ||
| 66 | |||
| 67 | This is an optional string to be used to add a Retry-After header | ||
| 68 | in the PSGI response. | ||
| 69 | |||
| 70 | =head1 AUTHORS | ||
| 71 | |||
| 72 | =over 4 | ||
| 73 | |||
| 74 | =item * | ||
| 75 | |||
| 76 | Stevan Little <stevan.little@iinteractive.com> | ||
| 77 | |||
| 78 | =item * | ||
| 79 | |||
| 80 | Ricardo Signes <cpan@semiotic.systems> | ||
| 81 | |||
| 82 | =back | ||
| 83 | |||
| 84 | =head1 COPYRIGHT AND LICENSE | ||
| 85 | |||
| 86 | This software is copyright (c) 2011 by Infinity Interactive, Inc. | ||
| 87 | |||
| 88 | This is free software; you can redistribute it and/or modify it under | ||
| 89 | the same terms as the Perl 5 programming language system itself. | ||
| 90 | |||
| 91 | =cut | ||
| 92 | |||
| 93 | __END__ |