Skip to content

Commit

Permalink
fix: added url error code dataNotAllowed as a network error (#847)
Browse files Browse the repository at this point in the history
Co-authored-by: Rita Zerrizuela <zeta@widcket.com>
  • Loading branch information
desusai7 and Widcket authored May 6, 2024
1 parent 9baf0ff commit a612d22
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Auth0/AuthenticationError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public struct AuthenticationError: Auth0APIError {
}

let networkErrorCodes: [URLError.Code] = [
.dataNotAllowed,
.notConnectedToInternet,
.networkConnectionLost,
.dnsLookupFailed,
Expand Down Expand Up @@ -183,7 +184,7 @@ extension AuthenticationError {

return "Received error with code \(self.code)."
}

}

// MARK: - Equatable
Expand Down
1 change: 1 addition & 0 deletions Auth0Tests/AuthenticationErrorSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ class AuthenticationErrorSpec: QuickSpec {

it("should detect network error") {
let networkErrorCodes: [URLError.Code] = [
.dataNotAllowed,
.notConnectedToInternet,
.networkConnectionLost,
.dnsLookupFailed,
Expand Down
6 changes: 3 additions & 3 deletions Auth0Tests/WebAuthSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -310,20 +310,20 @@ class WebAuthSpec: QuickSpec {
if #available(iOS 17.4, macOS 14.4, *) {
context("https") {
it("should build with the domain") {
expect(newWebAuth().redirectURL?.absoluteString) == "https://\(Domain)/\(platform)/\(bundleId)/callback"
expect(newWebAuth().useHTTPS().redirectURL?.absoluteString) == "https://\(Domain)/\(platform)/\(bundleId)/callback"
}

it("should build with the domain and a subpath") {
let subpath = "foo"
let uri = "https://\(Domain)/\(subpath)/\(platform)/\(bundleId)/callback"
let webAuth = Auth0WebAuth(clientId: ClientId, url: DomainURL.appendingPathComponent(subpath))
let webAuth = Auth0WebAuth(clientId: ClientId, url: DomainURL.appendingPathComponent(subpath)).useHTTPS()
expect(webAuth.redirectURL?.absoluteString) == uri
}

it("should build with the domain and subpaths") {
let subpaths = "foo/bar"
let uri = "https://\(Domain)/\(subpaths)/\(platform)/\(bundleId)/callback"
let webAuth = Auth0WebAuth(clientId: ClientId, url: DomainURL.appendingPathComponent(subpaths))
let webAuth = Auth0WebAuth(clientId: ClientId, url: DomainURL.appendingPathComponent(subpaths)).useHTTPS()
expect(webAuth.redirectURL?.absoluteString) == uri
}
}
Expand Down

0 comments on commit a612d22

Please sign in to comment.