diff --git a/miniapp/assets/assembly.js b/miniapp/assets/assembly.js index 94c2e00..d715af1 100644 --- a/miniapp/assets/assembly.js +++ b/miniapp/assets/assembly.js @@ -21,7 +21,7 @@ const Assembly = (function () { const ctrl = new AbortController(); const timer = setTimeout(() => ctrl.abort(), timeoutMs); try { - const res = await fetch(url, { method: "POST", signal: ctrl.signal, body: JSON.stringify(body) }); + const res = await fetch(url, { method: "POST", signal: ctrl.signal, headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) }); return await res.json(); } catch (e) { if (e.name === "AbortError") throw new Error("Сервер не отвечает — попробуйте ещё раз"); diff --git a/miniapp/assets/inbox.js b/miniapp/assets/inbox.js index fb9f48c..0f57255 100644 --- a/miniapp/assets/inbox.js +++ b/miniapp/assets/inbox.js @@ -24,6 +24,7 @@ const InboxScreen = (function () { try { const res = await fetch(`${BACKEND_URL}/api/${path}`, { method: "POST", signal: ctrl.signal, + headers: { "Content-Type": "application/json" }, body: JSON.stringify({ initData: tg?.initData || "", initDataUnsafe: tg?.initDataUnsafe || null, ...body }), }); return await res.json(); diff --git a/miniapp/assets/me.js b/miniapp/assets/me.js index a6303e7..a010e17 100644 --- a/miniapp/assets/me.js +++ b/miniapp/assets/me.js @@ -15,7 +15,7 @@ const MeScreen = (function () { const ctrl = new AbortController(); const t = setTimeout(() => ctrl.abort(), ms); try { - const res = await fetch(url, { method: "POST", signal: ctrl.signal, body: JSON.stringify(body) }); + const res = await fetch(url, { method: "POST", signal: ctrl.signal, headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) }); return await res.json(); } catch (e) { if (e.name === "AbortError") throw new Error("Сервер не отвечает"); diff --git a/miniapp/assets/measurements.js b/miniapp/assets/measurements.js index 2f99d70..d41e79e 100644 --- a/miniapp/assets/measurements.js +++ b/miniapp/assets/measurements.js @@ -98,7 +98,7 @@ const Measurements = (function () { const ctrl = new AbortController(); const timer = setTimeout(() => ctrl.abort(), timeoutMs); try { - const res = await fetch(url, { method: "POST", signal: ctrl.signal, body: JSON.stringify(body) }); + const res = await fetch(url, { method: "POST", signal: ctrl.signal, headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) }); return await res.json(); } catch (e) { if (e.name === "AbortError") throw new Error("Сервер не отвечает — попробуйте ещё раз"); diff --git a/miniapp/assets/proposals.js b/miniapp/assets/proposals.js index b9efa33..8bcfe4e 100644 --- a/miniapp/assets/proposals.js +++ b/miniapp/assets/proposals.js @@ -26,6 +26,7 @@ const Proposals = (function () { const res = await fetch(`${BACKEND_URL}/api/${path}`, { method: "POST", signal: ctrl.signal, + headers: { "Content-Type": "application/json" }, body: JSON.stringify({ ...authBody(), ...extra }), }); if (!res.ok) throw new Error("HTTP " + res.status); diff --git a/miniapp/assets/request.js b/miniapp/assets/request.js index 046d76c..05981df 100644 --- a/miniapp/assets/request.js +++ b/miniapp/assets/request.js @@ -19,7 +19,7 @@ const MeasurementRequest = (function () { const ctrl = new AbortController(); const timer = setTimeout(() => ctrl.abort(), timeoutMs); try { - const res = await fetch(url, { method: "POST", signal: ctrl.signal, body: JSON.stringify(body) }); + const res = await fetch(url, { method: "POST", signal: ctrl.signal, headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) }); return await res.json(); } catch (e) { if (e.name === "AbortError") throw new Error("Сервер не отвечает — попробуйте ещё раз");