chore: use the ability of `content-type` lib directly (#1276)

master
Jordan 2018-12-07 15:22:12 +08:00 committed by Yiyu He
parent 281a04e8e1
commit 5560f72912
1 changed files with 2 additions and 6 deletions

View File

@ -367,16 +367,12 @@ module.exports = {
*/
get charset() {
let type = this.get('Content-Type');
if (!type) return '';
try {
type = contentType.parse(type);
const { parameters } = contentType.parse(this.req);
return parameters.charset || '';
} catch (e) {
return '';
}
return type.parameters.charset || '';
},
/**