Skip to content

Commit

Permalink
custom content type should be a little faster
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 18, 2014
1 parent 65236ec commit 8fdb9a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/Mojolicious/Static.pm
Expand Up @@ -82,13 +82,13 @@ sub serve {
my ($self, $c, $rel) = @_;

return undef unless my $asset = $self->file($rel);

my $types = $c->app->types;
my $type = $rel =~ /\.(\w+)$/ ? $types->type($1) : undef;
my $headers = $c->res->headers;
$headers->content_type($type || $types->type('txt'))
unless $headers->content_type;
return !!$self->serve_asset($c, $asset) if $headers->content_type;

# Content-Type
my $types = $c->app->types;
my $type = $rel =~ /\.(\w+)$/ ? $types->type($1) : undef;
$headers->content_type($type || $types->type('txt'));
return !!$self->serve_asset($c, $asset);
}

Expand Down

0 comments on commit 8fdb9a9

Please sign in to comment.