Fix HTTP.request() 5xx handling with errorDelayMax=0
This was causing delay-less infinite loops for OPTIONS requests to Box, which are returning 502 errors.
This commit is contained in:
parent
63864f2f86
commit
00b24f85c9
2 changed files with 61 additions and 36 deletions
|
@ -169,6 +169,29 @@ describe("Zotero.HTTP", function () {
|
|||
assert.equal(delayStub.args[1][0], 20);
|
||||
});
|
||||
|
||||
it("shouldn't retry on 500 error if errorDelayMax=0", async function () {
|
||||
setResponse({
|
||||
method: "GET",
|
||||
url: "error",
|
||||
status: 500,
|
||||
text: ""
|
||||
});
|
||||
spy = sinon.spy(Zotero.HTTP, "_requestInternal");
|
||||
var e = await getPromiseError(
|
||||
Zotero.HTTP.request(
|
||||
"GET",
|
||||
baseURL + "error",
|
||||
{
|
||||
errorDelayIntervals: [10, 20, 100],
|
||||
errorDelayMax: 0
|
||||
}
|
||||
)
|
||||
);
|
||||
assert.instanceOf(e, Zotero.HTTP.UnexpectedStatusException);
|
||||
assert.isTrue(spy.calledOnce);
|
||||
assert.isTrue(delayStub.notCalled);
|
||||
});
|
||||
|
||||
it("should provide cancellerReceiver a callback to cancel while waiting to retry a 5xx error", async function () {
|
||||
delayStub.restore();
|
||||
setResponse({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue