braid-http 1.3.73 → 1.3.75
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 +19 -9
- package/package.json +1 -1
package/braid-http-client.js
CHANGED
|
@@ -435,15 +435,25 @@ async function braid_fetch (url, params = {}) {
|
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
-
if (params.retry) {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
438
|
+
if (params.retry && !res.ok) {
|
|
439
|
+
var give_up
|
|
440
|
+
if (params.retry.retryRes) {
|
|
441
|
+
give_up = !params.retry.retryRes(res)
|
|
442
|
+
} else {
|
|
443
|
+
give_up = res.status >= 400 && res.status < 600
|
|
444
|
+
|
|
445
|
+
switch (res.status) {
|
|
446
|
+
case 408: // Request Timeout
|
|
447
|
+
case 425: // Too Early
|
|
448
|
+
case 429: // Too Many Requests
|
|
449
|
+
|
|
450
|
+
case 502: // Bad Gateway
|
|
451
|
+
case 503: // Service Unavailable
|
|
452
|
+
case 504: // Gateway Timeout
|
|
453
|
+
give_up = false
|
|
454
|
+
}
|
|
455
|
+
if (res.statusText.match(/Missing Parents/i) ||
|
|
456
|
+
res.headers.get('retry-after') !== null)
|
|
447
457
|
give_up = false
|
|
448
458
|
}
|
|
449
459
|
if (give_up) {
|