Skip to content

Commit

Permalink
test response progress
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 10, 2012
1 parent fabc833 commit c5bf2b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/Template.pm
Expand Up @@ -520,7 +520,7 @@ Character indicating the start of a comment, defaults to C<#>.
=head2 C<compiled>
my $compiled = $mt->compiled;
$mt = $mt->compiled($code);
$mt = $mt->compiled($compiled);
Compiled template code.
Expand Down
10 changes: 6 additions & 4 deletions t/mojo/response.t
@@ -1,6 +1,6 @@
use Mojo::Base -strict;

use Test::More tests => 356;
use Test::More tests => 357;

# "Quick Smithers. Bring the mind eraser device!
# You mean the revolver, sir?
Expand Down Expand Up @@ -233,7 +233,8 @@ is $res->body, "Hello World!\n1234\nlalalala\n", 'right content';
# Parse full HTTP 1.1 response (100 Continue)
$res = Mojo::Message::Response->new;
$res->content->on(body => sub { shift->headers->header('X-Body' => 'one') });
$res->on(finish => sub { shift->headers->header('X-Finish' => 'two') });
$res->on(progress => sub { shift->headers->header('X-Progress' => 'two') });
$res->on(finish => sub { shift->headers->header('X-Finish' => 'three') });
$res->parse("HTTP/1.1 100 Continue\x0d\x0a\x0d\x0a");
ok $res->is_finished, 'response is finished';
ok $res->is_empty, 'response is empty';
Expand All @@ -242,8 +243,9 @@ is $res->code, 100, 'right status';
is $res->message, 'Continue', 'right message';
is $res->version, '1.1', 'right version';
is $res->headers->content_length, undef, 'no "Content-Length" value';
is $res->headers->header('X-Body'), 'one', 'right "X-Body" value';
is $res->headers->header('X-Finish'), 'two', 'right "X-Finish" value';
is $res->headers->header('X-Body'), 'one', 'right "X-Body" value';
is $res->headers->header('X-Progress'), 'two', 'right "X-Progress" value';
is $res->headers->header('X-Finish'), 'three', 'right "X-Finish" value';
is $res->body, '', 'no content';

# Parse full HTTP 1.1 response (304 Not Modified)
Expand Down

0 comments on commit c5bf2b6

Please sign in to comment.