HTTP.request() improvements
- Move 5xx retries and connection checking out of the sync API client and into HTTP.request() so that they apply to all requests. 429 handling remains in the API client, since not all callers necessarily want to handle that the same way. Callers can still handle 5xx themselves by including the relevant 5xx status codes in `successCodes` or by passing `errorDelayMax: 0`. - Add `cancellerReceiver` option, which is a callback that receives a function that will cancel the request, whether it's an active request or an automatic delay before a 5xx retry. This also updates Sinon to 7.3.2.
This commit is contained in:
parent
e25786e74c
commit
dc60e5f840
7 changed files with 451 additions and 223 deletions
|
@ -499,8 +499,14 @@ var modifyDataObject = function (obj, params = {}, saveOptions) {
|
|||
/**
|
||||
* Return a promise for the error thrown by a promise, or false if none
|
||||
*/
|
||||
function getPromiseError(promise) {
|
||||
return promise.thenReturn(false).catch(e => e);
|
||||
async function getPromiseError(promise) {
|
||||
try {
|
||||
await promise;
|
||||
}
|
||||
catch (e) {
|
||||
return e;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue