Skip to content

Commit 5d900d2

Browse files
authored
Merge pull request #3 from github/accept
Use content negotiation hint to identify requests
2 parents fddebe5 + 71deeae commit 5d900d2

File tree

4 files changed

+2011
-3584
lines changed

4 files changed

+2011
-3584
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ async function fetchResults(remoteInput: RemoteInputElement, checkCurrentQuery:
7171
remoteInput.dispatchEvent(new CustomEvent('loadstart'))
7272
remoteInput.setAttribute('loading', '')
7373
try {
74-
const html = await fetch(url).then(data => data.text())
74+
const response = await fetch(url, {headers: {accept: 'text/html; fragment'}})
75+
const html = await response.text()
7576
remoteInput.dispatchEvent(new CustomEvent('load'))
7677
resultsContainer.innerHTML = html
7778
} catch {

0 commit comments

Comments
 (0)