Skip to content

Commit

Permalink
fixed small renderer bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 10, 2010
1 parent ed00889 commit 1244e43
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -3,6 +3,7 @@ This file documents the revision history for Perl extension Mojolicious.
0.999926 2010-06-07 00:00:00
- Added version requirement for all optional dependencies.
- Improved documentation.
- Fixed small renderer bug.

0.999925 2010-06-07 00:00:00
- Updated WebSocket implementation to draft 76,
Expand Down
5 changes: 3 additions & 2 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -188,10 +188,11 @@ sub render_inner {
# Set
$stash->{content}->{$name}
||= ref $content eq 'CODE' ? $content->() : $content
if $content;
if defined $content;

# Get
$content = $stash->{content}->{$name} || '';
$content = $stash->{content}->{$name};
$content = '' unless defined $content;
return Mojo::ByteStream->new("$content");
}

Expand Down
15 changes: 10 additions & 5 deletions t/mojolicious/lite_app.t
Expand Up @@ -45,8 +45,11 @@ plugin 'header_condition';
# GET /
get '/' => 'root';

# GET /null
get '/null' => sub { shift->render_text(0) };
# GET /null/0
get '/null/:null' => sub {
my $self = shift;
$self->render(text => $self->param('null'), layout => 'layout');
};

# GET /привет/мир
get '/привет/мир' =>
Expand Down Expand Up @@ -407,9 +410,11 @@ $t->head_ok('/')->status_is(200)->header_is(Server => 'Mojolicious (Perl)')
$t->get_ok('/', '1234' x 1024)->status_is(200)
->content_is('/root.html/root.html/root.html/root.html/root.html');

# GET /null
$t->get_ok('/null')->status_is(200)->header_is(Server => 'Mojolicious (Perl)')
->header_is('X-Powered-By' => 'Mojolicious (Perl)')->content_is('0');
# GET /null/0
$t->get_ok('/null/0')->status_is(200)
->header_is(Server => 'Mojolicious (Perl)')
->header_is('X-Powered-By' => 'Mojolicious (Perl)')
->content_like(qr/layouted 0/);

# GET / (IRI)
$t->get_ok('/привет/мир')->status_is(200)
Expand Down

0 comments on commit 1244e43

Please sign in to comment.