Skip to content

Commit

Permalink
added request limit test (closes #329)
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 17, 2012
1 parent ce2ccf4 commit 9ec98cf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

2.96 2012-05-16
2.96 2012-05-17
- Added merge method to Mojo::Path.
- Improved documentation.
- Improved tests.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Message.pm
Expand Up @@ -219,7 +219,7 @@ sub is_dynamic { shift->content->is_dynamic }

sub is_finished { (shift->{state} || '') eq 'finished' }

sub is_limit_exceeded { ((shift->error)[1] || '') ~~ [413, 431] }
sub is_limit_exceeded { ((shift->error)[1] || 0) ~~ [413, 431] }

sub is_multipart { shift->content->is_multipart }

Expand Down
3 changes: 2 additions & 1 deletion t/mojo/request.t
Expand Up @@ -2,7 +2,7 @@ use Mojo::Base -strict;

use utf8;

use Test::More tests => 988;
use Test::More tests => 989;

# "When will I learn?
# The answer to life's problems aren't at the bottom of a bottle,
Expand Down Expand Up @@ -361,6 +361,7 @@ is $req->headers->content_length, undef, 'no "Content-Length" value';
# Parse HTTP 1.0 start line (with line size limit)
{
$req = Mojo::Message::Request->new;
ok !$req->is_limit_exceeded, 'limit is not exceeded';
local $ENV{MOJO_MAX_LINE_SIZE} = 5;
$req->parse('GET /foo/bar/baz.html HTTP/1');
ok $req->is_finished, 'request is finished';
Expand Down

0 comments on commit 9ec98cf

Please sign in to comment.