From 4f20dc627722d58a87d15604103cd16978541198 Mon Sep 17 00:00:00 2001 From: Jeremy Massel Date: Wed, 25 Mar 2020 16:22:33 -0600 Subject: [PATCH] Crash if event network response is invalid type --- .../Services/EventLoggingNetworkService.swift | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Automattic-Tracks-iOS/Services/EventLoggingNetworkService.swift b/Automattic-Tracks-iOS/Services/EventLoggingNetworkService.swift index 256014ea..36bb5bf5 100644 --- a/Automattic-Tracks-iOS/Services/EventLoggingNetworkService.swift +++ b/Automattic-Tracks-iOS/Services/EventLoggingNetworkService.swift @@ -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) {