Skip to content

Commit

Permalink
Merge pull request #11 from thierrybucco/master
Browse files Browse the repository at this point in the history
[fix] statusCode management. 404 was executing success completion block
  • Loading branch information
renssies authored Dec 9, 2019
2 parents 72414dc + 95692f1 commit e1437ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Ocarina/OcarinaManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ extension OcarinaManager: URLSessionDataDelegate {
return
}
let url = task.currentRequest?.url ?? originalURL
if let response = response, response.statusCode < 200 && response.statusCode >= 300 {
if let response = response, response.statusCode < 200 || response.statusCode >= 300 {
//We don't have a valid response, we end it here! If we don't have a response at all, we will just continue
let newError = NSError(domain: "co.awkward.ocarina", code: 500, userInfo: [NSLocalizedDescriptionKey: "Invalid response receibved from URL"])
let newError = NSError(domain: "co.awkward.ocarina", code: 500, userInfo: [NSLocalizedDescriptionKey: "Invalid response received from URL", "HTTPURLResponse": response])
self.completeRequestsWithError(newError, for: originalURL)
return
}
Expand Down

0 comments on commit e1437ed

Please sign in to comment.