File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ function getData(el) {
3737 }
3838}
3939
40+ function isWildcard ( accept ) {
41+ return accept && ! ! accept . split ( ',' ) . find ( x => x . match ( / ^ \s * \* \/ \* / ) )
42+ }
43+
4044export default class IncludeFragmentElement extends HTMLElement {
4145 constructor ( ) {
4246 super ( )
@@ -127,7 +131,7 @@ export default class IncludeFragmentElement extends HTMLElement {
127131 throw new Error ( `Failed to load resource: the server responded with a status of ${ response . status } ` )
128132 }
129133 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 / ) ) ) {
131135 throw new Error ( `Failed to load resource: expected ${ this . accept || 'text/html' } but was ${ ct } ` )
132136 }
133137 return response
You can’t perform that action at this time.
0 commit comments