From 7022466d297e8060e5b114795326b63aa44f2da4 Mon Sep 17 00:00:00 2001 From: Jeffrey Barrus Date: Wed, 3 May 2017 11:20:34 -0600 Subject: [PATCH] add logic to retry ajax requests up to 3 times --- lib/jasmine-jquery.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/jasmine-jquery.js b/lib/jasmine-jquery.js index 5f59e437..cb6e2872 100644 --- a/lib/jasmine-jquery.js +++ b/lib/jasmine-jquery.js @@ -259,10 +259,18 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. cache: false, dataType: 'json', url: url, + tryCount: 0, + retryLimit: 3, success: function (data) { self.fixturesCache_[relativeUrl] = data }, error: function ($xhr, status, err) { + this.tryCount++; + if (this.tryCount <= this.retryLimit) { + //try again + $.ajax(this) + return + } throw new Error('JSONFixture could not be loaded: ' + url + ' (status: ' + status + ', message: ' + err.message + ')') } })