Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.

Commit fde5fe9

Browse files
authored
Merge pull request #239 from danaospo/remove-retry-on-404
Fix: Do Not Retry on 404 HTTP Status Code
2 parents 17a7298 + a3e197c commit fde5fe9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Sources/SPTDataLoader/SPTDataLoaderResponse.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ - (BOOL)shouldRetry
106106
case SPTDataLoaderResponseHTTPStatusCodeExpectationFail:
107107
case SPTDataLoaderResponseHTTPStatusCodeHTTPVersionNotSupported:
108108
case SPTDataLoaderResponseHTTPStatusCodeNotImplemented:
109-
return NO;
110109
case SPTDataLoaderResponseHTTPStatusCodeNotFound:
110+
return NO;
111111
case SPTDataLoaderResponseHTTPStatusCodeRequestTimeout:
112112
case SPTDataLoaderResponseHTTPStatusCodeUnsupportedMediaTypes:
113113
case SPTDataLoaderResponseHTTPStatusCodeInternalServerError:

Tests/SPTDataLoader/SPTDataLoaderRequestTaskHandlerTest.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ - (void)testRetry
125125
[self.handler receiveResponse:httpResponse];
126126
[self.handler completeWithError:nil];
127127
XCTAssertEqual(self.requestResponseHandler.numberOfSuccessfulDataResponseCalls, 0u, @"The handler did relay a successful response onto its request response handler when it should have silently retried");
128-
XCTAssertEqual(self.requestResponseHandler.numberOfFailedResponseCalls, 0u, @"The handler did relay a failed response onto its request response handler when it should have silently retried");
128+
XCTAssertEqual(self.requestResponseHandler.numberOfFailedResponseCalls, 1u, @"The handler did not relay a failed response onto its request response handler for a 404 status code");
129129
}
130130

131131
- (void)testRetryWithResponseBody

Tests/SPTDataLoader/SPTDataLoaderResponseTest.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ - (void)testShouldRetryWithNotFoundHTTPStatusCode
6969
headerFields:nil];
7070
self.response = [SPTDataLoaderResponse dataLoaderResponseWithRequest:self.request response:self.urlResponse];
7171
BOOL shouldRetry = [self.response shouldRetry];
72-
XCTAssertTrue(shouldRetry, @"The response should retry when given the HTTP status code of Not Found");
72+
XCTAssertFalse(shouldRetry, @"The response should not retry when given the HTTP status code of Not Found");
7373
}
7474

7575
- (void)testShouldRetryForCertificateRejection

0 commit comments

Comments
 (0)