Skip to content

Commit

Permalink
chore: use the ability of content-type lib directly (#1276)
Browse files Browse the repository at this point in the history
  • Loading branch information
mingmingwon authored and dead-horse committed Dec 7, 2018
1 parent 281a04e commit 5560f72
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/request.js
Expand Up @@ -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 || '';
},

/**
Expand Down

0 comments on commit 5560f72

Please sign in to comment.