@kevisual/query 0.0.21 → 0.0.22
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/query-browser.d.ts +1 -1
- package/dist/query-browser.js +11 -4
- package/dist/query.d.ts +1 -1
- package/dist/query.js +11 -4
- package/package.json +1 -1
package/dist/query-browser.d.ts
CHANGED
|
@@ -197,7 +197,7 @@ declare class Query {
|
|
|
197
197
|
* @param fn 处理函数
|
|
198
198
|
*/
|
|
199
199
|
after(fn: DataOpts['afterResponse']): void;
|
|
200
|
-
fetchText(
|
|
200
|
+
fetchText(urlOrOptions?: string | QueryOpts$1, options?: QueryOpts$1): Promise<Result<any>>;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
declare class BaseQuery<T extends Query = Query, R extends {
|
package/dist/query-browser.js
CHANGED
|
@@ -454,13 +454,20 @@ class Query {
|
|
|
454
454
|
after(fn) {
|
|
455
455
|
this.afterResponse = fn;
|
|
456
456
|
}
|
|
457
|
-
async fetchText(
|
|
458
|
-
|
|
457
|
+
async fetchText(urlOrOptions, options) {
|
|
458
|
+
let _options = { ...options };
|
|
459
|
+
if (typeof urlOrOptions === 'string' && !_options.url) {
|
|
460
|
+
_options.url = urlOrOptions;
|
|
461
|
+
}
|
|
462
|
+
if (typeof urlOrOptions === 'object') {
|
|
463
|
+
_options = { ...urlOrOptions, ..._options };
|
|
464
|
+
}
|
|
465
|
+
const res = await adapter({
|
|
459
466
|
method: 'GET',
|
|
460
|
-
...
|
|
467
|
+
..._options,
|
|
461
468
|
headers: {
|
|
462
469
|
...this.headers,
|
|
463
|
-
...(
|
|
470
|
+
...(_options?.headers || {}),
|
|
464
471
|
},
|
|
465
472
|
});
|
|
466
473
|
if (!res.ok) {
|
package/dist/query.d.ts
CHANGED
|
@@ -204,7 +204,7 @@ declare class Query {
|
|
|
204
204
|
* @param fn 处理函数
|
|
205
205
|
*/
|
|
206
206
|
after(fn: DataOpts['afterResponse']): void;
|
|
207
|
-
fetchText(
|
|
207
|
+
fetchText(urlOrOptions?: string | QueryOpts, options?: QueryOpts): Promise<Result<any>>;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
declare class BaseQuery<T extends Query = Query, R extends {
|
package/dist/query.js
CHANGED
|
@@ -238,13 +238,20 @@ class Query {
|
|
|
238
238
|
after(fn) {
|
|
239
239
|
this.afterResponse = fn;
|
|
240
240
|
}
|
|
241
|
-
async fetchText(
|
|
242
|
-
|
|
241
|
+
async fetchText(urlOrOptions, options) {
|
|
242
|
+
let _options = { ...options };
|
|
243
|
+
if (typeof urlOrOptions === 'string' && !_options.url) {
|
|
244
|
+
_options.url = urlOrOptions;
|
|
245
|
+
}
|
|
246
|
+
if (typeof urlOrOptions === 'object') {
|
|
247
|
+
_options = { ...urlOrOptions, ..._options };
|
|
248
|
+
}
|
|
249
|
+
const res = await adapter({
|
|
243
250
|
method: 'GET',
|
|
244
|
-
...
|
|
251
|
+
..._options,
|
|
245
252
|
headers: {
|
|
246
253
|
...this.headers,
|
|
247
|
-
...(
|
|
254
|
+
...(_options?.headers || {}),
|
|
248
255
|
},
|
|
249
256
|
});
|
|
250
257
|
if (!res.ok) {
|