Skip to content

Commit

Permalink
fixed a auto rendering bug related to bridges
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 23, 2010
1 parent 86f24d1 commit fac3b1e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -14,6 +14,7 @@ This file documents the revision history for Perl extension Mojolicious.
- Fixed Mojo::Server::Daemon::Prefork not to prefork more workers
than allowed.
- Fixed graceful shutdown support in Mojo::Server::Daemon::Prefork.
- Fixed a auto rendering bug related to bridges.

0.999929 2010-08-17 00:00:00
- Removed OS X resource fork files.
Expand Down
5 changes: 3 additions & 2 deletions lib/MojoX/Dispatcher/Routes.pm
Expand Up @@ -267,8 +267,9 @@ sub _walk_stack {
my ($self, $c) = @_;

# Walk the stack
my $staging = $#{$c->match->stack};
my $staging = @{$c->match->stack};
for my $field (@{$c->match->stack}) {
$staging-- if $staging > 0;

# Params
$c->stash->{'mojo.params'}->append(%{$field});
Expand All @@ -292,7 +293,7 @@ sub _walk_stack {
}

# Break the chain
return unless $e;
return 1 if $staging && !$e;
}

# Done
Expand Down
1 change: 0 additions & 1 deletion lib/MojoX/Routes/Match.pm
Expand Up @@ -80,7 +80,6 @@ sub match {
}
$self->{_path} = $path;


# Merge captures
$captures = {%{$self->captures}, %$captures};
$self->captures($captures);
Expand Down
40 changes: 39 additions & 1 deletion t/mojolicious/lite_app.t
Expand Up @@ -14,7 +14,7 @@ use Test::More;
# Make sure sockets are working
plan skip_all => 'working sockets required for this test!'
unless Mojo::IOLoop->new->generate_port;
plan tests => 516;
plan tests => 530;

# Pollution
123 =~ m/(\d+)/;
Expand Down Expand Up @@ -484,6 +484,24 @@ under sub {
# GET /with_under_count
get '/with/under/count' => '*';

# Everything gets past this
under sub {
shift->res->headers->header('X-Possible' => 1);
return 1;
};

# GET /possible
get '/possible' => 'possible';

# Nothing gets past this
under sub {
shift->res->headers->header('X-Impossible' => 1);
return 0;
};

# GET /impossible
get '/impossible' => 'impossible';

# Oh Fry, I love you more than the moon, and the stars,
# and the POETIC IMAGE NUMBER 137 NOT FOUND
my $client = app->client;
Expand Down Expand Up @@ -1203,6 +1221,20 @@ $t->get_ok('/with/under/count', {'X-Bender' => 'Rodriguez'})->status_is(200)
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->header_is('X-Under' => 1)->content_is("counter\n");

# GET /possible
$t->get_ok('/possible')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->header_is('X-Possible' => 1)->header_is('X-Impossible' => undef)
->content_is("Possible!\n");

# GET /impossible
$t->get_ok('/impossible')->status_is(404)
->header_is(Server => 'Mojolicious (Perl)')
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->header_is('X-Possible' => undef)->header_is('X-Impossible' => 1)
->content_is("Oops!\n");

# Client timer
$client->ioloop->one_tick('0.1');
is( $timer,
Expand Down Expand Up @@ -1377,6 +1409,12 @@ app layout <%= content %><%= app->mode %>
@@ withundercount.html.ep
counter
@@ possible.html.ep
Possible!
@@ impossible.html.ep
Impossible
__END__
This is not a template!
lalala
Expand Down

0 comments on commit fac3b1e

Please sign in to comment.