fix price and modular

This commit is contained in:
2026-02-01 17:38:39 +03:30
parent 55f34aa15d
commit 164542d3e2
801 changed files with 16129 additions and 14478 deletions
@@ -67,6 +67,9 @@ function isJSONSerializable(value) {
if (value.buffer) {
return false;
}
if (value instanceof FormData || value instanceof URLSearchParams) {
return false;
}
return value.constructor && value.constructor.name === "Object" || typeof value.toJSON === "function";
}
const textTypes = /* @__PURE__ */ new Set([
@@ -84,6 +87,9 @@ function detectResponseType(_contentType = "") {
if (JSON_RE.test(contentType)) {
return "json";
}
if (contentType === "text/event-stream") {
return "stream";
}
if (textTypes.has(contentType) || contentType.startsWith("text/")) {
return "text";
}
@@ -205,6 +211,12 @@ function createFetch(globalOptions = {}) {
}
if (context.options.onRequest) {
await callHooks(context, context.options.onRequest);
if (!(context.options.headers instanceof Headers)) {
context.options.headers = new Headers(
context.options.headers || {}
/* compat */
);
}
}
if (typeof context.request === "string") {
if (context.options.baseURL) {
@@ -223,9 +235,13 @@ function createFetch(globalOptions = {}) {
}
if (context.options.body && isPayloadMethod(context.options.method)) {
if (isJSONSerializable(context.options.body)) {
context.options.body = typeof context.options.body === "string" ? context.options.body : JSON.stringify(context.options.body);
context.options.headers = new Headers(context.options.headers || {});
if (!context.options.headers.has("content-type")) {
const contentType = context.options.headers.get("content-type");
if (typeof context.options.body !== "string") {
context.options.body = contentType === "application/x-www-form-urlencoded" ? new URLSearchParams(
context.options.body
).toString() : JSON.stringify(context.options.body);
}
if (!contentType) {
context.options.headers.set("content-type", "application/json");
}
if (!context.options.headers.has("accept")) {