Skip to content

Commit

Permalink
fixed case sensitivity bug in Mojolicious::Types
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 8, 2014
1 parent a629a38 commit 246b9d3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -3,6 +3,7 @@
- Deprecated Mojo::Util::get_line.
- Fixed ";" handling in Mojo::Parameters to be compliant with the HTML
Living Standard.
- Fixed case sensitivity bug in Mojolicious::Types.

4.77 2014-02-06
- Deprecated Mojo::DOM::text_after and Mojo::DOM::text_before in favor of
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Types.pm
Expand Up @@ -55,8 +55,8 @@ sub detect {

sub type {
my ($self, $ext, $type) = @_;
return $self->types->{$ext}[0] unless $type;
$self->types->{$ext} = ref $type ? $type : [$type];
return $self->types->{lc $ext}[0] unless $type;
$self->types->{lc $ext} = ref $type ? $type : [$type];
return $self;
}

Expand Down
2 changes: 2 additions & 0 deletions t/mojolicious/types.t
Expand Up @@ -9,6 +9,8 @@ is $t->type('json'), 'application/json', 'right type';
is $t->type('foo'), undef, 'no type';
$t->type(foo => 'foo/bar');
is $t->type('foo'), 'foo/bar', 'right type';
$t->type(BAR => 'bar/baz');
is $t->type('Bar'), 'bar/baz', 'right type';

# Detect common MIME types
is_deeply $t->detect('text/cache-manifest'), ['appcache'], 'right formats';
Expand Down

0 comments on commit 246b9d3

Please sign in to comment.