File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ function getData(el) {
37
37
}
38
38
}
39
39
40
+ function isWildcard ( accept ) {
41
+ return accept && ! ! accept . split ( ',' ) . find ( x => x . match ( / ^ \s * \* \/ \* / ) )
42
+ }
43
+
40
44
export default class IncludeFragmentElement extends HTMLElement {
41
45
constructor ( ) {
42
46
super ( )
@@ -127,7 +131,7 @@ export default class IncludeFragmentElement extends HTMLElement {
127
131
throw new Error ( `Failed to load resource: the server responded with a status of ${ response . status } ` )
128
132
}
129
133
const ct = response . headers . get ( 'Content-Type' )
130
- if ( this . accept !== '*/*' && ( ! ct || ! ct . match ( this . accept ? this . accept : / ^ t e x t \/ h t m l / ) ) ) {
134
+ if ( ! isWildcard ( this . accept ) && ( ! ct || ! ct . match ( this . accept ? this . accept : / ^ t e x t \/ h t m l / ) ) ) {
131
135
throw new Error ( `Failed to load resource: expected ${ this . accept || 'text/html' } but was ${ ct } ` )
132
136
}
133
137
return response
You can’t perform that action at this time.
0 commit comments