Skip to content

Commit 9c01686

Browse files
committed
use .includes(..) instead of .match(..)
1 parent 02de738 commit 9c01686

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include-fragment-element.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default class IncludeFragmentElement extends HTMLElement {
123123
throw new Error(`Failed to load resource: the server responded with a status of ${response.status}`)
124124
}
125125
const ct = response.headers.get('Content-Type')
126-
if (!isWildcard(this.accept) && (!ct || !ct.match(this.accept ? this.accept : /^text\/html/))) {
126+
if (!isWildcard(this.accept) && (!ct || !ct.includes(this.accept ? this.accept : 'text/html'))) {
127127
throw new Error(`Failed to load resource: expected ${this.accept || 'text/html'} but was ${ct}`)
128128
}
129129
return response

0 commit comments

Comments
 (0)