Skip to content

Commit

Permalink
fix(DataStore): retry on session expired requests (#3477)
Browse files Browse the repository at this point in the history
* fix(DataStore): retry on session expired requests

* add test
  • Loading branch information
lawmicha authored Jan 22, 2024
1 parent 61e8b31 commit 11b7d5e
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,17 @@ class RequestRetryablePolicyTests: XCTestCase {
assertMilliseconds(retryAdvice.retryInterval, greaterThan: 200, lessThan: 300)
}

func testUserAuthenticationRequiredError() {
let retryableErrorCode = URLError.init(.userAuthenticationRequired)

let retryAdvice = retryPolicy.retryRequestAdvice(urlError: retryableErrorCode,
httpURLResponse: nil,
attemptNumber: 1)

XCTAssert(retryAdvice.shouldRetry)
assertMilliseconds(retryAdvice.retryInterval, greaterThan: 200, lessThan: 300)
}

func testHTTPTooManyRedirectsError() {
let nonRetryableErrorCode = URLError.init(.httpTooManyRedirects)

Expand Down

0 comments on commit 11b7d5e

Please sign in to comment.