braid-http 1.3.75 → 1.3.77
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/braid-http-client.js +6 -1
- package/package.json +1 -1
package/braid-http-client.js
CHANGED
|
@@ -132,6 +132,8 @@ if (is_nodejs) {
|
|
|
132
132
|
// window.fetch = braid_fetch
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
braid_fetch.set_fetch = f => normal_fetch = f
|
|
136
|
+
|
|
135
137
|
async function braid_fetch (url, params = {}) {
|
|
136
138
|
params = deep_copy(params) // Copy params, because we'll mutate it
|
|
137
139
|
|
|
@@ -437,7 +439,10 @@ async function braid_fetch (url, params = {}) {
|
|
|
437
439
|
|
|
438
440
|
if (params.retry && !res.ok) {
|
|
439
441
|
var give_up
|
|
440
|
-
if (params.retry
|
|
442
|
+
if (typeof params.retry === 'function') {
|
|
443
|
+
give_up = !params.retry(res)
|
|
444
|
+
} else if (params.retry.retryRes) {
|
|
445
|
+
// deprecated in favor of setting retry to a function
|
|
441
446
|
give_up = !params.retry.retryRes(res)
|
|
442
447
|
} else {
|
|
443
448
|
give_up = res.status >= 400 && res.status < 600
|