« Throwable/Role/Status/PreconditionFailed.pm
↑ Summary
Throwable/Role/Status/RequestURITooLong.pm »
| 1 | package HTTP::Throwable::Role::Status::RequestEntityTooLarge; | ||
| 2 | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 3 | $HTTP::Throwable::Role::Status::RequestEntityTooLarge::VERSION = '0.027'; | ||
| 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.027 | ||
| 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 ATTRIBUTES | ||
| 54 | |||
| 55 | =head2 retry_after | ||
| 56 | |||
| 57 | This is an optional string to be used to add a Retry-After header | ||
| 58 | in the PSGI response. | ||
| 59 | |||
| 60 | =head1 AUTHORS | ||
| 61 | |||
| 62 | =over 4 | ||
| 63 | |||
| 64 | =item * | ||
| 65 | |||
| 66 | Stevan Little <stevan.little@iinteractive.com> | ||
| 67 | |||
| 68 | =item * | ||
| 69 | |||
| 70 | Ricardo Signes <rjbs@cpan.org> | ||
| 71 | |||
| 72 | =back | ||
| 73 | |||
| 74 | =head1 COPYRIGHT AND LICENSE | ||
| 75 | |||
| 76 | This software is copyright (c) 2011 by Infinity Interactive, Inc. | ||
| 77 | |||
| 78 | This is free software; you can redistribute it and/or modify it under | ||
| 79 | the same terms as the Perl 5 programming language system itself. | ||
| 80 | |||
| 81 | =cut | ||
| 82 | |||
| 83 | __END__ |