Skip to content

Commit

Permalink
Try to leave no transaction behind. Default response code should not …
Browse files Browse the repository at this point in the history
…be 200.
  • Loading branch information
Acajou committed Aug 16, 2009
1 parent ac5ea7e commit 555cdfe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/MojoX/UserAgent.pm
Expand Up @@ -350,6 +350,17 @@ sub _find_finished_pipe {
while (my $inner = shift @{$tx->finished}) {
push @{$finished}, $inner;
}

# We must also unpack from the other two queues...
while (my $inner = (shift @{$tx->inactive} || shift @{$tx->active})) {
unless ($inner->has_error) {
$tx->has_error
? $inner->error($tx->error)
: $inner->error('Something weird happened');
}
push @{$finished}, $inner;
}

}
else {
push @{$finished}, $tx;
Expand Down
2 changes: 2 additions & 0 deletions lib/MojoX/UserAgent/Transaction.pm
Expand Up @@ -24,6 +24,8 @@ sub new {
if ( !defined($arg_ref->{url})
|| !defined($arg_ref->{ua}));

$self->res->code(999); # Default response status should not be 200

my $url = $arg_ref->{url};
ref $url && $url->isa('Mojo::URL')
? $req->url($url)
Expand Down

0 comments on commit 555cdfe

Please sign in to comment.