chore: use the ability of content-type
lib directly (#1276)
This commit is contained in:
parent
281a04e8e1
commit
5560f72912
1 changed files with 2 additions and 6 deletions
|
@ -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 || '';
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue