diff --git a/Agent/Network/NRMANetworkFacade.mm b/Agent/Network/NRMANetworkFacade.mm index 5cd1b5e0..f406f3fc 100644 --- a/Agent/Network/NRMANetworkFacade.mm +++ b/Agent/Network/NRMANetworkFacade.mm @@ -122,10 +122,12 @@ + (void) noticeNetworkRequest:(NSURLRequest*)request contentType:[NRMANetworkFacade contentType:response] bytesSent:bytesSent]; NSUInteger modifiedBytesReceived = bytesReceived; - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*) response; - NSString* header = httpResponse.allHeaderFields[@"Content-Encoding"]; - if ([header isEqualToString:@"gzip"]) { - modifiedBytesReceived = [[NRMAHarvesterConnection gzipData:responseData] length]; + if (([response isKindOfClass:[NSHTTPURLResponse class]])) { + NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*) response; + NSString* header = httpResponse.allHeaderFields[@"Content-Encoding"]; + if ([header isEqualToString:@"gzip"]) { + modifiedBytesReceived = [[NRMAHarvesterConnection gzipData:responseData] length]; + } }