From a49e13a728598b3bcdce613b3854dddaeaf97457 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Mon, 15 Jun 2020 21:01:23 +0200 Subject: Specify Accept header in Fetch requests. Change-Id: I6634b9c6abc0ad7a688d4d3aa4e16349ad996cff --- .../META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js | 4 ++-- .../META-INF/resources/lazychat/MlkLazychatSubmissionForm.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/resources/META-INF') diff --git a/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js b/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js index c6249ae..6ecc355 100644 --- a/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js +++ b/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js @@ -147,7 +147,7 @@ export class MlkBookmarkSubmissionForm extends HTMLElement { let searchParams = new URLSearchParams({'uri': this.uriInput.value}); console.log(`/bookmarks/page-info?${searchParams.toString()}`); let fetchUrl = new URL(`/bookmarks/page-info?${searchParams.toString()}`, document.URL); - let r = await fetch(fetchUrl); + let r = await fetch(fetchUrl, {headers: {"accept": "application/json"}}); this.uriSpinner.hidden = true; this.uriSpinner.playing = false; @@ -165,7 +165,7 @@ export class MlkBookmarkSubmissionForm extends HTMLElement { } let fetchUrl = new URL(`/posts/${this.editedId}`, document.URL); - let r = await fetch(fetchUrl); + let r = await fetch(fetchUrl, {headers: {"accept": "application/json"}}); if (!r.ok) { return; diff --git a/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js b/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js index 3dce33d..c6334ad 100644 --- a/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js +++ b/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js @@ -100,7 +100,7 @@ export class MlkLazychatSubmissionForm extends HTMLElement { } let fetchUrl = new URL(`/posts/${this.editedId}`, document.URL); - let r = await fetch(fetchUrl); + let r = await fetch(fetchUrl, {headers: {"accept": "application/json"}}); if (!r.ok) { return; -- cgit v1.2.3