1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.fetch_retry = exports.fetch_no_cache = void 0;
|
4 | const fetch_1 = require("../fetch");
|
5 | function fetch_no_cache(url, method = 'GET') {
|
6 | const req = typeof Request === 'function' ? new Request(url) : url;
|
7 | const headers = new Headers();
|
8 | headers.append('pragma', 'no-cache');
|
9 | headers.append('cache-control', 'no-cache');
|
10 | const init = {
|
11 | method,
|
12 | cache: 'no-cache',
|
13 | headers,
|
14 | };
|
15 | return fetch_1.fetch(req, init);
|
16 | }
|
17 | exports.fetch_no_cache = fetch_no_cache;
|
18 | exports.fetch_retry = (url, num_remain = 1, e) => num_remain <= 0
|
19 | ? Promise.reject(e)
|
20 | : fetch_1.fetch(url).catch(e => exports.fetch_retry(url, num_remain - 1, e));
|
21 |
|
\ | No newline at end of file |