refactor: use mime-extended

This commit is contained in:
Jonathan Ong 2014-04-19 07:45:57 -07:00
parent 74cb04e7c1
commit e472a18010
3 changed files with 8 additions and 11 deletions

View file

@ -1,4 +1,9 @@
HEAD /
==================
* refactor mime with mime-extended
0.5.5 / 2014-04-14
==================

View file

@ -11,7 +11,7 @@ var status = require('statuses');
var destroy = require('dethroy');
var http = require('http');
var path = require('path');
var mime = require('mime');
var mime = require('mime-extended');
var basename = path.basename;
var extname = path.extname;
@ -265,16 +265,7 @@ module.exports = {
*/
set type(type) {
// mime
if (!~type.indexOf('/')) type = mime.lookup(type);
// charset
if (!~type.indexOf('charset')) {
var cs = mime.charsets.lookup(type);
if (cs) type += '; charset=' + cs.toLowerCase();
}
this.set('Content-Type', type);
this.set('Content-Type', mime.contentType(type));
},
/**

View file

@ -29,6 +29,7 @@
"co": "~3.0.2",
"debug": "*",
"mime": "~1.2.11",
"mime-extended": "^1.0.0",
"fresh": "~0.2.1",
"koa-compose": "~2.2.0",
"cookies": "~0.4.0",