Skip to content

Commit

Permalink
fixed small bug in upload_lite_app.t
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 20, 2011
1 parent e73e1de commit aa6a838
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -2,6 +2,7 @@ This file documents the revision history for Perl extension Mojolicious.

2.03 2011-10-20 00:00:00
- Improved documentation.
- Fixed small bug in "upload_lite_app.t".

2.02 2011-10-20 00:00:00
- Merged request and upgrade events in Mojo::Transaction::HTTP.
Expand Down
5 changes: 3 additions & 2 deletions lib/Mojo/Message.pm
Expand Up @@ -583,8 +583,9 @@ Emitted after message building or parsing is finished.
Emitted when message building or parsing makes progress.
$message->on(progress => sub {
my $message = shift;
my $len = $message->headers->content_length;
my $message = shift;
return unless $message->content->is_parsing_body || $message->is_done;
return unless my $len = $message->headers->content_length;
my $progress = $message->content->progress;
say 'Progress: ',
$progress == $len ? 100 : int($progress / ($len / 100)), '%';
Expand Down
3 changes: 3 additions & 0 deletions t/mojolicious/upload_lite_app.t
Expand Up @@ -26,6 +26,9 @@ app->hook(
progress => sub {
my $req = shift;

# Check if we've reached the body yet
return unless $req->content->is_parsing_body || $req->is_done;

# Check for id
return unless my $id = $req->url->query->param('upload_id');

Expand Down

0 comments on commit aa6a838

Please sign in to comment.