Skip to content

Commit

Permalink
[sdk] Include 3XX http responses in success results (#25)
Browse files Browse the repository at this point in the history
* [sdk] Include 3XX http responses in success results

* [sdk] Include 3XX http responses in success results
  • Loading branch information
murki authored Sep 5, 2024
1 parent a5e8d0f commit cb0bbe2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ internal class CaptureOkHttpEventListener internal constructor(

// Do not use OkHttp's `isSuccess` logic for determining whether a given response is
// successful or not to keep iOS and Android implementation in sync.
val isSuccess = (statusCode in 200..<300) ||
statusCode == 304 // "Not Modified" status code
val isSuccess = (statusCode in 200..<400)

// Capture response URL attributes in case there was a redirect and attributes such as host,
// path, and query have different values for the original request and the response.
Expand All @@ -238,7 +237,7 @@ internal class CaptureOkHttpEventListener internal constructor(
} else {
HttpResponse.HttpResult.FAILURE
},
statusCode = response.code,
statusCode = statusCode,
headers = response.headers.toMap(),
)

Expand Down
3 changes: 1 addition & 2 deletions platform/swift/source/network/native/HTTPStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ struct HTTPStatus {

private extension Int {
var isSuccess: Bool {
return (200..<300).contains(self)
|| self == 304 // "Not Modified" status code
return (200..<400).contains(self)
}
}

0 comments on commit cb0bbe2

Please sign in to comment.