Omit content type in POST request if no body

f26a672811bd695085ab8ced988e4d86c3f6b5e1

Cohee <18619528+Cohee1207@users.noreply.github.com>

17 files changed, +35 -35Showing whitespace changes
public/script.js+1 -1
@@ -643,7 +643,7 @@ export async function pingServer() {
643643 try {
644644 const result = await fetch('api/ping', {
645645 method: 'POST',
646646 headers: getRequestHeaders({ omitContentType: true }),
647647 });
648648
649649 if (!result.ok) {
public/scripts/data-maid.js+1 -1
@@ -68,7 +68,7 @@ class DataMaidDialog {
6868 async getReport() {
6969 const response = await fetch('/api/data-maid/report', {
7070 method: 'POST',
7171 headers: getRequestHeaders({ omitContentType: true }),
7272 });
7373
7474 if (!response.ok) {
public/scripts/extensions/assets/index.js+1 -1
@@ -425,7 +425,7 @@ async function updateCurrentAssets() {
425425 try {
426426 const result = await fetch('/api/assets/get', {
427427 method: 'POST',
428428 headers: getRequestHeaders({ omitContentType: true }),
429429 });
430430 currentAssets = result.ok ? (await result.json()) : {};
431431 }
public/scripts/extensions/caption/index.js+1 -1
@@ -594,7 +594,7 @@ jQuery(async function () {
594594 const options = Array.from(dropdown.options);
595595 const response = await fetch(url, {
596596 method: 'POST',
597597 headers: getRequestHeaders({ omitContentType: true }),
598598 });
599599 if (!response.ok) {
600600 return;
public/scripts/extensions/expressions/index.js+1 -1
@@ -1414,7 +1414,7 @@ export async function getExpressionsList({ filterAvailable = false } = {}) {
14141414 if (extension_settings.expressions.api == EXPRESSION_API.local) {
14151415 const apiResult = await fetch('/api/extra/classify/labels', {
14161416 method: 'POST',
14171417 headers: getRequestHeaders({ omitContentType: true }),
14181418 });
14191419
14201420 if (apiResult.ok) {
public/scripts/extensions/gallery/index.js+1 -1
@@ -159,7 +159,7 @@ async function getGalleryFolders() {
159159 try {
160160 const response = await fetch('/api/images/folders', {
161161 method: 'POST',
162162 headers: getRequestHeaders({ omitContentType: true }),
163163 });
164164
165165 if (!response.ok) {
public/scripts/extensions/stable-diffusion/index.js+9 -9
@@ -1570,7 +1570,7 @@ async function loadSamplers() {
15701570async function loadHordeSamplers() {
15711571 const result = await fetch('/api/horde/sd-samplers', {
15721572 method: 'POST',
15731573 headers: getRequestHeaders({ omitContentType: true }),
15741574 });
15751575
15761576 if (result.ok) {
@@ -1866,7 +1866,7 @@ async function loadFalaiModels() {
18661866
18671867 const result = await fetch('/api/sd/falai/models', {
18681868 method: 'POST',
18691869 headers: getRequestHeaders({ omitContentType: true }),
18701870 });
18711871
18721872 if (result.ok) {
@@ -1885,7 +1885,7 @@ async function loadXAIModels() {
18851885async function loadPollinationsModels() {
18861886 const result = await fetch('/api/sd/pollinations/models', {
18871887 method: 'POST',
18881888 headers: getRequestHeaders({ omitContentType: true }),
18891889 });
18901890
18911891 if (result.ok) {
@@ -1903,7 +1903,7 @@ async function loadTogetherAIModels() {
19031903
19041904 const result = await fetch('/api/sd/together/models', {
19051905 method: 'POST',
19061906 headers: getRequestHeaders({ omitContentType: true }),
19071907 });
19081908
19091909 if (result.ok) {
@@ -1921,7 +1921,7 @@ async function loadChutesModels() {
19211921
19221922 const result = await fetch('/api/sd/chutes/models', {
19231923 method: 'POST',
19241924 headers: getRequestHeaders({ omitContentType: true }),
19251925 });
19261926
19271927 if (result.ok) {
@@ -1942,7 +1942,7 @@ async function loadElectronHubModels() {
19421942
19431943 const result = await fetch('/api/sd/electronhub/models', {
19441944 method: 'POST',
19451945 headers: getRequestHeaders({ omitContentType: true }),
19461946 });
19471947
19481948 function getModelName(model) {
@@ -1975,7 +1975,7 @@ async function loadNanoGPTModels() {
19751975
19761976 const result = await fetch('/api/sd/nanogpt/models', {
19771977 method: 'POST',
19781978 headers: getRequestHeaders({ omitContentType: true }),
19791979 });
19801980
19811981 if (result.ok) {
@@ -1988,7 +1988,7 @@ async function loadNanoGPTModels() {
19881988async function loadHordeModels() {
19891989 const result = await fetch('/api/horde/sd-models', {
19901990 method: 'POST',
19911991 headers: getRequestHeaders({ omitContentType: true }),
19921992 });
19931993
19941994
@@ -2122,7 +2122,7 @@ async function loadAimlapiModels() {
21222122
21232123 const result = await fetch('/api/sd/aimlapi/models', {
21242124 method: 'POST',
21252125 headers: getRequestHeaders({ omitContentType: true }),
21262126 });
21272127
21282128 if (!result.ok) {
public/scripts/extensions/tts/edge.js+1 -1
@@ -259,7 +259,7 @@ class EdgeTtsProvider {
259259 try {
260260 const result = await fetch('/api/plugins/edge-tts/probe', {
261261 method: 'POST',
262262 headers: getRequestHeaders({ omitContentType: true }),
263263 });
264264 return result.ok;
265265 } catch (e) {
public/scripts/extensions/tts/electronhub.js+1 -1
@@ -187,7 +187,7 @@ class ElectronHubTtsProvider {
187187 try {
188188 const response = await fetch('/api/openai/electronhub/models', {
189189 method: 'POST',
190190 headers: getRequestHeaders({ omitContentType: true }),
191191 });
192192 if (!response.ok) {
193193 throw new Error(`HTTP ${response.status}: ${await response.text()}`);
public/scripts/extensions/vectors/index.js+3 -3
@@ -1163,7 +1163,7 @@ async function loadChutesModels() {
11631163 try {
11641164 const response = await fetch('/api/openai/chutes/models/embedding', {
11651165 method: 'POST',
11661166 headers: getRequestHeaders({ omitContentType: true }),
11671167 });
11681168 if (!response.ok) {
11691169 throw new Error(`HTTP ${response.status}`);
@@ -1197,7 +1197,7 @@ async function loadElectronHubModels() {
11971197 try {
11981198 const response = await fetch('/api/openai/electronhub/models', {
11991199 method: 'POST',
12001200 headers: getRequestHeaders({ omitContentType: true }),
12011201 });
12021202 if (!response.ok) {
12031203 throw new Error(`HTTP ${response.status}`);
@@ -1236,7 +1236,7 @@ async function loadOpenRouterModels() {
12361236 try {
12371237 const response = await fetch('/api/openrouter/models/embedding', {
12381238 method: 'POST',
12391239 headers: getRequestHeaders({ omitContentType: true }),
12401240 });
12411241 if (!response.ok) {
12421242 throw new Error(`HTTP ${response.status}`);
public/scripts/group-chats.js+1 -1
@@ -752,7 +752,7 @@ export async function renameGroupMember(oldAvatar, newAvatar, newName) {
752752async function getGroups() {
753753 const response = await fetch('/api/groups/all', {
754754 method: 'POST',
755755 headers: getRequestHeaders({ omitContentType: true }),
756756 });
757757
758758 if (response.ok) {
public/scripts/horde.js+2 -2
@@ -107,7 +107,7 @@ export async function checkHordeStatus() {
107107 try {
108108 const response = await fetch('/api/horde/status', {
109109 method: 'POST',
110110 headers: getRequestHeaders({ omitContentType: true }),
111111 });
112112
113113 if (!response.ok) {
@@ -328,7 +328,7 @@ export function loadHordeSettings(settings) {
328328async function showKudos() {
329329 const response = await fetch('/api/horde/user-info', {
330330 method: 'POST',
331331 headers: getRequestHeaders({ omitContentType: true }),
332332 });
333333
334334 if (!response.ok) {
public/scripts/personas.js+1 -1
@@ -234,7 +234,7 @@ function addMissingPersonas(avatarsList) {
234234export async function getUserAvatars(doRender = true, openPageAt = '') {
235235 const response = await fetch('/api/avatars/get', {
236236 method: 'POST',
237237 headers: getRequestHeaders({ omitContentType: true }),
238238 });
239239 if (response.ok) {
240240 const allEntities = await response.json();
public/scripts/scrapers.js+2 -2
@@ -259,7 +259,7 @@ class MediaWikiScraper {
259259 try {
260260 const result = await fetch('/api/plugins/fandom/probe-mediawiki', {
261261 method: 'POST',
262262 headers: getRequestHeaders({ omitContentType: true }),
263263 });
264264
265265 return result.ok;
@@ -352,7 +352,7 @@ class FandomScraper {
352352 try {
353353 const result = await fetch('/api/plugins/fandom/probe', {
354354 method: 'POST',
355355 headers: getRequestHeaders({ omitContentType: true }),
356356 });
357357
358358 return result.ok;
public/scripts/secrets.js+2 -2
@@ -268,7 +268,7 @@ function getActiveSecretLabel(key) {
268268async function viewSecrets() {
269269 const response = await fetch('/api/secrets/view', {
270270 method: 'POST',
271271 headers: getRequestHeaders({ omitContentType: true }),
272272 });
273273
274274 if (response.status == 403) {
@@ -372,7 +372,7 @@ export async function readSecretState() {
372372 try {
373373 const response = await fetch('/api/secrets/read', {
374374 method: 'POST',
375375 headers: getRequestHeaders({ omitContentType: true }),
376376 });
377377
378378 if (response.ok) {
public/scripts/user.js+6 -6
@@ -83,7 +83,7 @@ async function getUsers() {
8383 try {
8484 const response = await fetch('/api/users/get', {
8585 method: 'POST',
8686 headers: getRequestHeaders({ omitContentType: true }),
8787 });
8888
8989 if (!response.ok) {
@@ -535,7 +535,7 @@ async function getSnapshots() {
535535 try {
536536 const response = await fetch('/api/settings/get-snapshots', {
537537 method: 'POST',
538538 headers: getRequestHeaders({ omitContentType: true }),
539539 });
540540
541541 if (!response.ok) {
@@ -561,7 +561,7 @@ async function makeSnapshot(callback) {
561561 try {
562562 const response = await fetch('/api/settings/make-snapshot', {
563563 method: 'POST',
564564 headers: getRequestHeaders({ omitContentType: true }),
565565 });
566566
567567 if (!response.ok) {
@@ -620,7 +620,7 @@ async function resetEverything(callback) {
620620 try {
621621 const step1Response = await fetch('/api/users/reset-step1', {
622622 method: 'POST',
623623 headers: getRequestHeaders({ omitContentType: true }),
624624 });
625625
626626 if (!step1Response.ok) {
@@ -860,7 +860,7 @@ async function openAdminPanel() {
860860async function logout() {
861861 await fetch('/api/users/logout', {
862862 method: 'POST',
863863 headers: getRequestHeaders({ omitContentType: true }),
864864 });
865865
866866 // On an explicit logout stop auto login
@@ -904,7 +904,7 @@ async function extendUserSession() {
904904 try {
905905 const response = await fetch('/api/ping?extend=1', {
906906 method: 'POST',
907907 headers: getRequestHeaders({ omitContentType: true }),
908908 });
909909
910910 if (!response.ok) {
public/scripts/utils.js+1 -1
@@ -1978,7 +1978,7 @@ export async function extractTextFromOffice(blob) {
19781978 try {
19791979 const result = await fetch('/api/plugins/office/probe', {
19801980 method: 'POST',
19811981 headers: getRequestHeaders({ omitContentType: true }),
19821982 });
19831983
19841984 return result.ok;