@beyonk/http 12.1.2 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -2
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -123,8 +123,12 @@ var Api = class {
|
|
|
123
123
|
}
|
|
124
124
|
if (this.client) {
|
|
125
125
|
return this.client;
|
|
126
|
-
}
|
|
127
|
-
|
|
126
|
+
}
|
|
127
|
+
if (config?.fetch) {
|
|
128
|
+
return config.fetch;
|
|
129
|
+
}
|
|
130
|
+
if ("fetch" in globalThis) {
|
|
131
|
+
return globalThis.fetch;
|
|
128
132
|
}
|
|
129
133
|
throw Error("No client provided and can't find one automatically");
|
|
130
134
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -6,6 +6,8 @@ type ApiOptions = {
|
|
|
6
6
|
baseUrl?: string;
|
|
7
7
|
/** Mock client for testing */
|
|
8
8
|
mock?: FetchClient;
|
|
9
|
+
/** Fetch client for HTTP requests */
|
|
10
|
+
fetch?: FetchClient;
|
|
9
11
|
/** Whether to retry failed requests */
|
|
10
12
|
retry?: RetryOptions | false;
|
|
11
13
|
/** Whether to parse error responses as JSON */
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ type ApiOptions = {
|
|
|
6
6
|
baseUrl?: string;
|
|
7
7
|
/** Mock client for testing */
|
|
8
8
|
mock?: FetchClient;
|
|
9
|
+
/** Fetch client for HTTP requests */
|
|
10
|
+
fetch?: FetchClient;
|
|
9
11
|
/** Whether to retry failed requests */
|
|
10
12
|
retry?: RetryOptions | false;
|
|
11
13
|
/** Whether to parse error responses as JSON */
|
package/dist/index.js
CHANGED
|
@@ -98,8 +98,12 @@ var Api = class {
|
|
|
98
98
|
}
|
|
99
99
|
if (this.client) {
|
|
100
100
|
return this.client;
|
|
101
|
-
}
|
|
102
|
-
|
|
101
|
+
}
|
|
102
|
+
if (config?.fetch) {
|
|
103
|
+
return config.fetch;
|
|
104
|
+
}
|
|
105
|
+
if ("fetch" in globalThis) {
|
|
106
|
+
return globalThis.fetch;
|
|
103
107
|
}
|
|
104
108
|
throw Error("No client provided and can't find one automatically");
|
|
105
109
|
}
|