File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -55,8 +55,12 @@ router.applyMiddleware = () => {
5555 if ( req . headers . accept ) {
5656 // 406 Not Acceptable
5757 let matchingTypes = req . headers . accept . split ( / , ? / )
58- matchingTypes = matchingTypes . filter ( mediaType => // Accept application/*, */vnd.api+json, */* and the correct JSON:API type.
59- mediaType . match ( / ^ ( \* | a p p l i c a t i o n ) \/ ( \* | j s o n | v n d \. a p i \+ j s o n ) $ / ) || mediaType . match ( / \* \/ \* / ) )
58+ matchingTypes = matchingTypes . filter ( mediaType => {
59+ // Remove charset encoding
60+ const type = mediaType . split ( ';' ) [ 0 ] ;
61+ // Accept application/*, */vnd.api+json, */* and the correct JSON:API type.
62+ return type . match ( / ^ ( \* | a p p l i c a t i o n ) \/ ( \* | j s o n | v n d \. a p i \+ j s o n ) $ / ) || type . match ( / \* \/ \* / )
63+ } )
6064
6165 if ( matchingTypes . length === 0 ) {
6266 return res . status ( 406 ) . end ( )
You can’t perform that action at this time.
0 commit comments