File tree 3 files changed +10
-7
lines changed
3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ unreleased
2
2
==========
3
3
4
4
* Drop node <18
5
- * deps: replace media-typer with content-type
5
+ * Use ` content-type ` and ` media-typer ` for type validation
6
+ - No behavior changes, upgrades ` media-typer `
6
7
* deps: mime-types@^3.0.0
7
8
- Add ` application/toml ` with extension ` .toml `
8
9
- Add ` application/ubjson ` with extension ` .ubj `
Original file line number Diff line number Diff line change 12
12
* @private
13
13
*/
14
14
15
- var typer = require ( 'content-type' )
15
+ var contentType = require ( 'content-type' )
16
16
var mime = require ( 'mime-types' )
17
+ var typer = require ( 'media-typer' )
17
18
18
19
/**
19
20
* Module exports.
@@ -237,13 +238,13 @@ function mimeMatch (expected, actual) {
237
238
238
239
function normalizeType ( value ) {
239
240
// parse the type
240
- var type = typer . parse ( value )
241
+ var type = contentType . parse ( value ) . type
241
242
242
- // remove the parameters
243
- type . parameters = undefined
243
+ if ( ! typer . test ( type ) ) {
244
+ return null
245
+ }
244
246
245
- // reformat it
246
- return typer . format ( type )
247
+ return type
247
248
}
248
249
249
250
/**
Original file line number Diff line number Diff line change 10
10
"repository" : " jshttp/type-is" ,
11
11
"dependencies" : {
12
12
"content-type" : " ^1.0.5" ,
13
+ "media-typer" : " ~1.1.0" ,
13
14
"mime-types" : " ^3.0.0"
14
15
},
15
16
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments