Skip to content

Commit

Permalink
another MIME type prioritization test
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 14, 2012
1 parent 2a0bfb7 commit a4ac04b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Mojolicious/Types.pm
Expand Up @@ -45,8 +45,8 @@ sub detect {

# Detect extensions from MIME types
my @exts;
my $types = $self->types;
for my $type (@types) {
my $types = $self->types;
for my $ext (sort keys %$types) {
my @types = ref $types->{$ext} ? @{$types->{$ext}} : ($types->{$ext});
$type eq $_ and push @exts, $ext for map { s/\;.*$//; lc $_ } @types;
Expand Down
2 changes: 2 additions & 0 deletions t/mojolicious/types.t
Expand Up @@ -75,5 +75,7 @@ is_deeply $t->detect('TEXT/HTML;Q=0.8,text/plain;Q=0.9', 1),
['txt', 'htm', 'html'], 'right formats';
is_deeply $t->detect(' TEXT/HTML , text/plain;Q=0.9', 1),
['htm', 'html', 'txt'], 'right formats';
is_deeply $t->detect('text/plain;q=0.5, text/xml, application/xml;q=0.1', 1),
['xml', 'txt', 'xml'], 'right formats';

done_testing();

0 comments on commit a4ac04b

Please sign in to comment.