Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added appcache MIME type

  • Loading branch information...
commit cdb0ad373baad47b404131b91ff2d73bc3cb0292 1 parent 31a0abe
@kraih authored
Showing with 60 additions and 56 deletions.
  1. +1 −0  Changes
  2. +52 −50 lib/Mojolicious/Types.pm
  3. +7 −6 t/mojolicious/types.t
View
1  Changes
@@ -1,5 +1,6 @@
3.23 2012-08-07
+ - Added appcache MIME type.
- Improved documentation.
3.22 2012-08-06
View
102 lib/Mojolicious/Types.pm
@@ -5,31 +5,32 @@ use Mojo::Base -base;
# hungry investor."
has types => sub {
{
- atom => 'application/atom+xml',
- bin => 'application/octet-stream',
- css => 'text/css',
- gif => 'image/gif',
- gz => 'application/x-gzip',
- htm => 'text/html',
- html => 'text/html;charset=UTF-8',
- ico => 'image/x-icon',
- jpeg => 'image/jpeg',
- jpg => 'image/jpeg',
- js => 'application/javascript',
- json => 'application/json',
- mp3 => 'audio/mpeg',
- mp4 => 'video/mp4',
- ogg => 'audio/ogg',
- ogv => 'video/ogg',
- pdf => 'application/pdf',
- png => 'image/png',
- rss => 'application/rss+xml',
- svg => 'image/svg+xml',
- txt => 'text/plain',
- webm => 'video/webm',
- woff => 'application/font-woff',
- xml => ['application/xml', 'text/xml'],
- zip => 'application/zip'
+ appcache => 'text/cache-manifest',
+ atom => 'application/atom+xml',
+ bin => 'application/octet-stream',
+ css => 'text/css',
+ gif => 'image/gif',
+ gz => 'application/x-gzip',
+ htm => 'text/html',
+ html => 'text/html;charset=UTF-8',
+ ico => 'image/x-icon',
+ jpeg => 'image/jpeg',
+ jpg => 'image/jpeg',
+ js => 'application/javascript',
+ json => 'application/json',
+ mp3 => 'audio/mpeg',
+ mp4 => 'video/mp4',
+ ogg => 'audio/ogg',
+ ogv => 'video/ogg',
+ pdf => 'application/pdf',
+ png => 'image/png',
+ rss => 'application/rss+xml',
+ svg => 'image/svg+xml',
+ txt => 'text/plain',
+ webm => 'video/webm',
+ woff => 'application/font-woff',
+ xml => ['application/xml', 'text/xml'],
+ zip => 'application/zip'
};
};
@@ -76,31 +77,32 @@ Mojolicious::Types - MIME types
L<Mojolicious::Types> manages MIME types for L<Mojolicious>.
- atom -> application/atom+xml
- bin -> application/octet-stream
- css -> text/css
- gif -> image/gif
- gz -> application/x-gzip
- htm -> text/html
- html -> text/html;charset=UTF-8
- ico -> image/x-icon
- jpeg -> image/jpeg
- jpg -> image/jpeg
- js -> application/javascript
- json -> application/json
- mp3 -> audio/mpeg
- mp4 -> video/mp4
- ogg -> audio/ogg
- ogv -> video/ogg
- pdf -> application/pdf
- png -> image/png
- rss -> application/rss+xml
- svg -> image/svg+xml
- txt -> text/plain
- webm -> video/webm
- woff -> application/font-woff
- xml -> application/xml,text/xml
- zip -> application/zip
+ appcache -> text/cache-manifest
+ atom -> application/atom+xml
+ bin -> application/octet-stream
+ css -> text/css
+ gif -> image/gif
+ gz -> application/x-gzip
+ htm -> text/html
+ html -> text/html;charset=UTF-8
+ ico -> image/x-icon
+ jpeg -> image/jpeg
+ jpg -> image/jpeg
+ js -> application/javascript
+ json -> application/json
+ mp3 -> audio/mpeg
+ mp4 -> video/mp4
+ ogg -> audio/ogg
+ ogv -> video/ogg
+ pdf -> application/pdf
+ png -> image/png
+ rss -> application/rss+xml
+ svg -> image/svg+xml
+ txt -> text/plain
+ webm -> video/webm
+ woff -> application/font-woff
+ xml -> application/xml,text/xml
+ zip -> application/zip
The most common ones are already defined.
View
13 t/mojolicious/types.t
@@ -1,6 +1,6 @@
use Mojo::Base -strict;
-use Test::More tests => 49;
+use Test::More tests => 50;
# "Your mistletoe is no match for my *tow* missile."
use Mojolicious::Types;
@@ -13,11 +13,12 @@ $t->type(foo => 'foo/bar');
is $t->type('foo'), 'foo/bar', 'right type';
# Detect common MIME types
-is_deeply $t->detect('application/atom+xml'), ['atom'], 'right formats';
-is_deeply $t->detect('application/octet-stream'), ['bin'], 'right formats';
-is_deeply $t->detect('text/css'), ['css'], 'right formats';
-is_deeply $t->detect('image/gif'), ['gif'], 'right formats';
-is_deeply $t->detect('application/x-gzip'), ['gz'], 'right formats';
+is_deeply $t->detect('text/cache-manifest'), ['appcache'], 'right formats';
+is_deeply $t->detect('application/atom+xml'), ['atom'], 'right formats';
+is_deeply $t->detect('application/octet-stream'), ['bin'], 'right formats';
+is_deeply $t->detect('text/css'), ['css'], 'right formats';
+is_deeply $t->detect('image/gif'), ['gif'], 'right formats';
+is_deeply $t->detect('application/x-gzip'), ['gz'], 'right formats';
is_deeply $t->detect('text/html'), ['htm', 'html'], 'right formats';
is_deeply $t->detect('image/x-icon'), ['ico'], 'right formats';
is_deeply $t->detect('image/jpeg'), ['jpeg', 'jpg'], 'right formats';
Please sign in to comment.
Something went wrong with that request. Please try again.