refactor: use mime-extended
This commit is contained in:
parent
74cb04e7c1
commit
e472a18010
3 changed files with 8 additions and 11 deletions
|
@ -1,4 +1,9 @@
|
||||||
|
|
||||||
|
HEAD /
|
||||||
|
==================
|
||||||
|
|
||||||
|
* refactor mime with mime-extended
|
||||||
|
|
||||||
0.5.5 / 2014-04-14
|
0.5.5 / 2014-04-14
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ var status = require('statuses');
|
||||||
var destroy = require('dethroy');
|
var destroy = require('dethroy');
|
||||||
var http = require('http');
|
var http = require('http');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var mime = require('mime');
|
var mime = require('mime-extended');
|
||||||
var basename = path.basename;
|
var basename = path.basename;
|
||||||
var extname = path.extname;
|
var extname = path.extname;
|
||||||
|
|
||||||
|
@ -265,16 +265,7 @@ module.exports = {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
set type(type) {
|
set type(type) {
|
||||||
// mime
|
this.set('Content-Type', mime.contentType(type));
|
||||||
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);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
"co": "~3.0.2",
|
"co": "~3.0.2",
|
||||||
"debug": "*",
|
"debug": "*",
|
||||||
"mime": "~1.2.11",
|
"mime": "~1.2.11",
|
||||||
|
"mime-extended": "^1.0.0",
|
||||||
"fresh": "~0.2.1",
|
"fresh": "~0.2.1",
|
||||||
"koa-compose": "~2.2.0",
|
"koa-compose": "~2.2.0",
|
||||||
"cookies": "~0.4.0",
|
"cookies": "~0.4.0",
|
||||||
|
|
Loading…
Reference in a new issue