Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added url error code dataNotAllowed as a network error #847

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
}

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

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

Check warning on line 187 in Auth0/AuthenticationError.swift

View workflow job for this annotation

GitHub Actions / Lint code with SwiftLint

Lines should not have trailing whitespace (trailing_whitespace)
}

// 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
Loading