Skip to content

Commit

Permalink
Crash if event network response is invalid type
Browse files Browse the repository at this point in the history
  • Loading branch information
jkmassel committed Mar 25, 2020
1 parent 7dafc39 commit 4f20dc6
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ open class EventLoggingNetworkService {
return
}

/// The `response` should *always* be an HTTPURLResponse, but we'll be defensive anyway
guard let statusCode = (response as? HTTPURLResponse)?.statusCode else {
completion(.success(data))
return
}
/// The `response` should *always* be an HTTPURLResponse. Crash if notl
let statusCode = (response as! HTTPURLResponse).statusCode

/// Generate a reasonable error message based on the HTTP status
if !(200 ... 299).contains(statusCode) {
Expand Down

0 comments on commit 4f20dc6

Please sign in to comment.