Skip to content

Commit

Permalink
more MIME type detection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 4, 2012
1 parent b5697ec commit 91d684a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Mojolicious/Types.pm
Expand Up @@ -111,7 +111,7 @@ the following ones.
=head2 C<detect>
my $first = $types->detect('application/json;q=9');
my $all = $types->detect('application/json;q=9', 1);
my $all = $types->detect('application/json;q=9,text/plain', 1);
Detect file extensions from C<Accept> header value, detection of more than
one MIME type is disabled by default.
Expand Down
7 changes: 6 additions & 1 deletion t/mojolicious/types.t
@@ -1,6 +1,6 @@
use Mojo::Base -strict;

use Test::More tests => 32;
use Test::More tests => 34;

# "Your mistletoe is no match for my *tow* missile."
use Mojolicious::Types;
Expand Down Expand Up @@ -44,6 +44,11 @@ is_deeply $t->detect('text/html;q=0.8,*/*;q=0.9'), [], 'no formats';
# Multiple MIME types
is_deeply $t->detect('text/html;q=0.9,text/plain', 1), ['txt', 'htm', 'html'],
'right formats';
is_deeply $t->detect('Text/Html;q=0.9,Text/Plain', 1), ['txt', 'htm', 'html'],
'right formats';
is_deeply $t->detect('TEXT/HTML;v=9;q=0.9,TEXT/PLAIN', 1),
['txt', 'htm', 'html'],
'right formats';
is_deeply $t->detect('application/json, text/javascript, */*; q=0.01', 1),
['json'], 'right formats';
is_deeply $t->detect('application/json , image/svg+xml ; q=10, image/png', 1),
Expand Down

0 comments on commit 91d684a

Please sign in to comment.