Omit content type in POST request if no body

f26a672811bd695085ab8ced988e4d86c3f6b5e1

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

17 files changed, +35 -35Ignore whitespace
public/script.js+1 -1
@@ -643,7 +643,7 @@ export async function pingServer() {
643 try {643 try {
644 const result = await fetch('api/ping', {644 const result = await fetch('api/ping', {
645 method: 'POST',645 method: 'POST',
646 headers: getRequestHeaders(),646 headers: getRequestHeaders({ omitContentType: true }),
647 });647 });
648648
649 if (!result.ok) {649 if (!result.ok) {
public/scripts/data-maid.js+1 -1
@@ -68,7 +68,7 @@ class DataMaidDialog {
68 async getReport() {68 async getReport() {
69 const response = await fetch('/api/data-maid/report', {69 const response = await fetch('/api/data-maid/report', {
70 method: 'POST',70 method: 'POST',
71 headers: getRequestHeaders(),71 headers: getRequestHeaders({ omitContentType: true }),
72 });72 });
7373
74 if (!response.ok) {74 if (!response.ok) {
public/scripts/extensions/assets/index.js+1 -1
@@ -425,7 +425,7 @@ async function updateCurrentAssets() {
425 try {425 try {
426 const result = await fetch('/api/assets/get', {426 const result = await fetch('/api/assets/get', {
427 method: 'POST',427 method: 'POST',
428 headers: getRequestHeaders(),428 headers: getRequestHeaders({ omitContentType: true }),
429 });429 });
430 currentAssets = result.ok ? (await result.json()) : {};430 currentAssets = result.ok ? (await result.json()) : {};
431 }431 }
public/scripts/extensions/caption/index.js+1 -1
@@ -594,7 +594,7 @@ jQuery(async function () {
594 const options = Array.from(dropdown.options);594 const options = Array.from(dropdown.options);
595 const response = await fetch(url, {595 const response = await fetch(url, {
596 method: 'POST',596 method: 'POST',
597 headers: getRequestHeaders(),597 headers: getRequestHeaders({ omitContentType: true }),
598 });598 });
599 if (!response.ok) {599 if (!response.ok) {
600 return;600 return;
public/scripts/extensions/expressions/index.js+1 -1
@@ -1414,7 +1414,7 @@ export async function getExpressionsList({ filterAvailable = false } = {}) {
1414 if (extension_settings.expressions.api == EXPRESSION_API.local) {1414 if (extension_settings.expressions.api == EXPRESSION_API.local) {
1415 const apiResult = await fetch('/api/extra/classify/labels', {1415 const apiResult = await fetch('/api/extra/classify/labels', {
1416 method: 'POST',1416 method: 'POST',
1417 headers: getRequestHeaders(),1417 headers: getRequestHeaders({ omitContentType: true }),
1418 });1418 });
14191419
1420 if (apiResult.ok) {1420 if (apiResult.ok) {
public/scripts/extensions/gallery/index.js+1 -1
@@ -159,7 +159,7 @@ async function getGalleryFolders() {
159 try {159 try {
160 const response = await fetch('/api/images/folders', {160 const response = await fetch('/api/images/folders', {
161 method: 'POST',161 method: 'POST',
162 headers: getRequestHeaders(),162 headers: getRequestHeaders({ omitContentType: true }),
163 });163 });
164164
165 if (!response.ok) {165 if (!response.ok) {
public/scripts/extensions/stable-diffusion/index.js+9 -9
@@ -1570,7 +1570,7 @@ async function loadSamplers() {
1570async function loadHordeSamplers() {1570async function loadHordeSamplers() {
1571 const result = await fetch('/api/horde/sd-samplers', {1571 const result = await fetch('/api/horde/sd-samplers', {
1572 method: 'POST',1572 method: 'POST',
1573 headers: getRequestHeaders(),1573 headers: getRequestHeaders({ omitContentType: true }),
1574 });1574 });
15751575
1576 if (result.ok) {1576 if (result.ok) {
@@ -1866,7 +1866,7 @@ async function loadFalaiModels() {
18661866
1867 const result = await fetch('/api/sd/falai/models', {1867 const result = await fetch('/api/sd/falai/models', {
1868 method: 'POST',1868 method: 'POST',
1869 headers: getRequestHeaders(),1869 headers: getRequestHeaders({ omitContentType: true }),
1870 });1870 });
18711871
1872 if (result.ok) {1872 if (result.ok) {
@@ -1885,7 +1885,7 @@ async function loadXAIModels() {
1885async function loadPollinationsModels() {1885async function loadPollinationsModels() {
1886 const result = await fetch('/api/sd/pollinations/models', {1886 const result = await fetch('/api/sd/pollinations/models', {
1887 method: 'POST',1887 method: 'POST',
1888 headers: getRequestHeaders(),1888 headers: getRequestHeaders({ omitContentType: true }),
1889 });1889 });
18901890
1891 if (result.ok) {1891 if (result.ok) {
@@ -1903,7 +1903,7 @@ async function loadTogetherAIModels() {
19031903
1904 const result = await fetch('/api/sd/together/models', {1904 const result = await fetch('/api/sd/together/models', {
1905 method: 'POST',1905 method: 'POST',
1906 headers: getRequestHeaders(),1906 headers: getRequestHeaders({ omitContentType: true }),
1907 });1907 });
19081908
1909 if (result.ok) {1909 if (result.ok) {
@@ -1921,7 +1921,7 @@ async function loadChutesModels() {
19211921
1922 const result = await fetch('/api/sd/chutes/models', {1922 const result = await fetch('/api/sd/chutes/models', {
1923 method: 'POST',1923 method: 'POST',
1924 headers: getRequestHeaders(),1924 headers: getRequestHeaders({ omitContentType: true }),
1925 });1925 });
19261926
1927 if (result.ok) {1927 if (result.ok) {
@@ -1942,7 +1942,7 @@ async function loadElectronHubModels() {
19421942
1943 const result = await fetch('/api/sd/electronhub/models', {1943 const result = await fetch('/api/sd/electronhub/models', {
1944 method: 'POST',1944 method: 'POST',
1945 headers: getRequestHeaders(),1945 headers: getRequestHeaders({ omitContentType: true }),
1946 });1946 });
19471947
1948 function getModelName(model) {1948 function getModelName(model) {
@@ -1975,7 +1975,7 @@ async function loadNanoGPTModels() {
19751975
1976 const result = await fetch('/api/sd/nanogpt/models', {1976 const result = await fetch('/api/sd/nanogpt/models', {
1977 method: 'POST',1977 method: 'POST',
1978 headers: getRequestHeaders(),1978 headers: getRequestHeaders({ omitContentType: true }),
1979 });1979 });
19801980
1981 if (result.ok) {1981 if (result.ok) {
@@ -1988,7 +1988,7 @@ async function loadNanoGPTModels() {
1988async function loadHordeModels() {1988async function loadHordeModels() {
1989 const result = await fetch('/api/horde/sd-models', {1989 const result = await fetch('/api/horde/sd-models', {
1990 method: 'POST',1990 method: 'POST',
1991 headers: getRequestHeaders(),1991 headers: getRequestHeaders({ omitContentType: true }),
1992 });1992 });
19931993
19941994
@@ -2122,7 +2122,7 @@ async function loadAimlapiModels() {
21222122
2123 const result = await fetch('/api/sd/aimlapi/models', {2123 const result = await fetch('/api/sd/aimlapi/models', {
2124 method: 'POST',2124 method: 'POST',
2125 headers: getRequestHeaders(),2125 headers: getRequestHeaders({ omitContentType: true }),
2126 });2126 });
21272127
2128 if (!result.ok) {2128 if (!result.ok) {
public/scripts/extensions/tts/edge.js+1 -1
@@ -259,7 +259,7 @@ class EdgeTtsProvider {
259 try {259 try {
260 const result = await fetch('/api/plugins/edge-tts/probe', {260 const result = await fetch('/api/plugins/edge-tts/probe', {
261 method: 'POST',261 method: 'POST',
262 headers: getRequestHeaders(),262 headers: getRequestHeaders({ omitContentType: true }),
263 });263 });
264 return result.ok;264 return result.ok;
265 } catch (e) {265 } catch (e) {
public/scripts/extensions/tts/electronhub.js+1 -1
@@ -187,7 +187,7 @@ class ElectronHubTtsProvider {
187 try {187 try {
188 const response = await fetch('/api/openai/electronhub/models', {188 const response = await fetch('/api/openai/electronhub/models', {
189 method: 'POST',189 method: 'POST',
190 headers: getRequestHeaders(),190 headers: getRequestHeaders({ omitContentType: true }),
191 });191 });
192 if (!response.ok) {192 if (!response.ok) {
193 throw new Error(`HTTP ${response.status}: ${await response.text()}`);193 throw new Error(`HTTP ${response.status}: ${await response.text()}`);
public/scripts/extensions/vectors/index.js+3 -3
@@ -1163,7 +1163,7 @@ async function loadChutesModels() {
1163 try {1163 try {
1164 const response = await fetch('/api/openai/chutes/models/embedding', {1164 const response = await fetch('/api/openai/chutes/models/embedding', {
1165 method: 'POST',1165 method: 'POST',
1166 headers: getRequestHeaders(),1166 headers: getRequestHeaders({ omitContentType: true }),
1167 });1167 });
1168 if (!response.ok) {1168 if (!response.ok) {
1169 throw new Error(`HTTP ${response.status}`);1169 throw new Error(`HTTP ${response.status}`);
@@ -1197,7 +1197,7 @@ async function loadElectronHubModels() {
1197 try {1197 try {
1198 const response = await fetch('/api/openai/electronhub/models', {1198 const response = await fetch('/api/openai/electronhub/models', {
1199 method: 'POST',1199 method: 'POST',
1200 headers: getRequestHeaders(),1200 headers: getRequestHeaders({ omitContentType: true }),
1201 });1201 });
1202 if (!response.ok) {1202 if (!response.ok) {
1203 throw new Error(`HTTP ${response.status}`);1203 throw new Error(`HTTP ${response.status}`);
@@ -1236,7 +1236,7 @@ async function loadOpenRouterModels() {
1236 try {1236 try {
1237 const response = await fetch('/api/openrouter/models/embedding', {1237 const response = await fetch('/api/openrouter/models/embedding', {
1238 method: 'POST',1238 method: 'POST',
1239 headers: getRequestHeaders(),1239 headers: getRequestHeaders({ omitContentType: true }),
1240 });1240 });
1241 if (!response.ok) {1241 if (!response.ok) {
1242 throw new Error(`HTTP ${response.status}`);1242 throw new Error(`HTTP ${response.status}`);
public/scripts/group-chats.js+1 -1
@@ -752,7 +752,7 @@ export async function renameGroupMember(oldAvatar, newAvatar, newName) {
752async function getGroups() {752async function getGroups() {
753 const response = await fetch('/api/groups/all', {753 const response = await fetch('/api/groups/all', {
754 method: 'POST',754 method: 'POST',
755 headers: getRequestHeaders(),755 headers: getRequestHeaders({ omitContentType: true }),
756 });756 });
757757
758 if (response.ok) {758 if (response.ok) {
public/scripts/horde.js+2 -2
@@ -107,7 +107,7 @@ export async function checkHordeStatus() {
107 try {107 try {
108 const response = await fetch('/api/horde/status', {108 const response = await fetch('/api/horde/status', {
109 method: 'POST',109 method: 'POST',
110 headers: getRequestHeaders(),110 headers: getRequestHeaders({ omitContentType: true }),
111 });111 });
112112
113 if (!response.ok) {113 if (!response.ok) {
@@ -328,7 +328,7 @@ export function loadHordeSettings(settings) {
328async function showKudos() {328async function showKudos() {
329 const response = await fetch('/api/horde/user-info', {329 const response = await fetch('/api/horde/user-info', {
330 method: 'POST',330 method: 'POST',
331 headers: getRequestHeaders(),331 headers: getRequestHeaders({ omitContentType: true }),
332 });332 });
333333
334 if (!response.ok) {334 if (!response.ok) {
public/scripts/personas.js+1 -1
@@ -234,7 +234,7 @@ function addMissingPersonas(avatarsList) {
234export async function getUserAvatars(doRender = true, openPageAt = '') {234export async function getUserAvatars(doRender = true, openPageAt = '') {
235 const response = await fetch('/api/avatars/get', {235 const response = await fetch('/api/avatars/get', {
236 method: 'POST',236 method: 'POST',
237 headers: getRequestHeaders(),237 headers: getRequestHeaders({ omitContentType: true }),
238 });238 });
239 if (response.ok) {239 if (response.ok) {
240 const allEntities = await response.json();240 const allEntities = await response.json();
public/scripts/scrapers.js+2 -2
@@ -259,7 +259,7 @@ class MediaWikiScraper {
259 try {259 try {
260 const result = await fetch('/api/plugins/fandom/probe-mediawiki', {260 const result = await fetch('/api/plugins/fandom/probe-mediawiki', {
261 method: 'POST',261 method: 'POST',
262 headers: getRequestHeaders(),262 headers: getRequestHeaders({ omitContentType: true }),
263 });263 });
264264
265 return result.ok;265 return result.ok;
@@ -352,7 +352,7 @@ class FandomScraper {
352 try {352 try {
353 const result = await fetch('/api/plugins/fandom/probe', {353 const result = await fetch('/api/plugins/fandom/probe', {
354 method: 'POST',354 method: 'POST',
355 headers: getRequestHeaders(),355 headers: getRequestHeaders({ omitContentType: true }),
356 });356 });
357357
358 return result.ok;358 return result.ok;
public/scripts/secrets.js+2 -2
@@ -268,7 +268,7 @@ function getActiveSecretLabel(key) {
268async function viewSecrets() {268async function viewSecrets() {
269 const response = await fetch('/api/secrets/view', {269 const response = await fetch('/api/secrets/view', {
270 method: 'POST',270 method: 'POST',
271 headers: getRequestHeaders(),271 headers: getRequestHeaders({ omitContentType: true }),
272 });272 });
273273
274 if (response.status == 403) {274 if (response.status == 403) {
@@ -372,7 +372,7 @@ export async function readSecretState() {
372 try {372 try {
373 const response = await fetch('/api/secrets/read', {373 const response = await fetch('/api/secrets/read', {
374 method: 'POST',374 method: 'POST',
375 headers: getRequestHeaders(),375 headers: getRequestHeaders({ omitContentType: true }),
376 });376 });
377377
378 if (response.ok) {378 if (response.ok) {
public/scripts/user.js+6 -6
@@ -83,7 +83,7 @@ async function getUsers() {
83 try {83 try {
84 const response = await fetch('/api/users/get', {84 const response = await fetch('/api/users/get', {
85 method: 'POST',85 method: 'POST',
86 headers: getRequestHeaders(),86 headers: getRequestHeaders({ omitContentType: true }),
87 });87 });
8888
89 if (!response.ok) {89 if (!response.ok) {
@@ -535,7 +535,7 @@ async function getSnapshots() {
535 try {535 try {
536 const response = await fetch('/api/settings/get-snapshots', {536 const response = await fetch('/api/settings/get-snapshots', {
537 method: 'POST',537 method: 'POST',
538 headers: getRequestHeaders(),538 headers: getRequestHeaders({ omitContentType: true }),
539 });539 });
540540
541 if (!response.ok) {541 if (!response.ok) {
@@ -561,7 +561,7 @@ async function makeSnapshot(callback) {
561 try {561 try {
562 const response = await fetch('/api/settings/make-snapshot', {562 const response = await fetch('/api/settings/make-snapshot', {
563 method: 'POST',563 method: 'POST',
564 headers: getRequestHeaders(),564 headers: getRequestHeaders({ omitContentType: true }),
565 });565 });
566566
567 if (!response.ok) {567 if (!response.ok) {
@@ -620,7 +620,7 @@ async function resetEverything(callback) {
620 try {620 try {
621 const step1Response = await fetch('/api/users/reset-step1', {621 const step1Response = await fetch('/api/users/reset-step1', {
622 method: 'POST',622 method: 'POST',
623 headers: getRequestHeaders(),623 headers: getRequestHeaders({ omitContentType: true }),
624 });624 });
625625
626 if (!step1Response.ok) {626 if (!step1Response.ok) {
@@ -860,7 +860,7 @@ async function openAdminPanel() {
860async function logout() {860async function logout() {
861 await fetch('/api/users/logout', {861 await fetch('/api/users/logout', {
862 method: 'POST',862 method: 'POST',
863 headers: getRequestHeaders(),863 headers: getRequestHeaders({ omitContentType: true }),
864 });864 });
865865
866 // On an explicit logout stop auto login866 // On an explicit logout stop auto login
@@ -904,7 +904,7 @@ async function extendUserSession() {
904 try {904 try {
905 const response = await fetch('/api/ping?extend=1', {905 const response = await fetch('/api/ping?extend=1', {
906 method: 'POST',906 method: 'POST',
907 headers: getRequestHeaders(),907 headers: getRequestHeaders({ omitContentType: true }),
908 });908 });
909909
910 if (!response.ok) {910 if (!response.ok) {
public/scripts/utils.js+1 -1
@@ -1978,7 +1978,7 @@ export async function extractTextFromOffice(blob) {
1978 try {1978 try {
1979 const result = await fetch('/api/plugins/office/probe', {1979 const result = await fetch('/api/plugins/office/probe', {
1980 method: 'POST',1980 method: 'POST',
1981 headers: getRequestHeaders(),1981 headers: getRequestHeaders({ omitContentType: true }),
1982 });1982 });
19831983
1984 return result.ok;1984 return result.ok;