Skip to content

Commit

Permalink
let req and res die more gracefully if the connection has already bee…
Browse files Browse the repository at this point in the history
…n closed
  • Loading branch information
kraih committed Aug 27, 2016
1 parent 1baed1c commit 1e0f1a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
Expand Up @@ -4,6 +4,8 @@
operations in subprocesses, without blocking the event loop. (jberger, sri)
- Added EXPERIMENTAL module Mojo::IOLoop::Subprocess. (jberger, sri)
- Added EXPERIMENTAL subprocess method to Mojo::IOLoop. (jberger, sri)
- Improved req and res methods in Mojolicious::Controller to die more
gracefully if the connection has already been closed.
- Fixed bug where Mojo::UserAgent would try to follow redirects for CONNECT
requests.

Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -218,8 +218,8 @@ sub rendered {
return $self;
}

sub req { shift->tx->req }
sub res { shift->tx->res }
sub req { (shift->tx || Carp::croak 'Connection already closed')->req }
sub res { (shift->tx || Carp::croak 'Connection already closed')->res }

sub respond_to {
my ($self, $args) = (shift, ref $_[0] ? $_[0] : {@_});
Expand Down

0 comments on commit 1e0f1a3

Please sign in to comment.