Skip to content

Commit

Permalink
chore: use the ability of content-type lib directly (koajs#1276)
Browse files Browse the repository at this point in the history
  • Loading branch information
mingmingwon authored and kiku-jw committed Feb 26, 2019
1 parent 281a04e commit acf480e
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 acf480e

Please sign in to comment.