Fix handling of HTTP 304 from infrastructure ws

This commit is contained in:
Davide De Rosa 2018-12-06 10:37:22 +01:00
parent d25753a263
commit 9daf64648b
1 changed files with 15 additions and 1 deletions

View File

@ -136,7 +136,21 @@ class InfrastructureFactory {
self.lastUpdate[name] = Date()
}
guard let response = response, let infra = response.value, let lastModified = response.lastModified else {
guard let response = response else {
log.error("No response from web service")
DispatchQueue.main.async {
completionHandler(nil, error)
}
return
}
if response.isCached {
log.debug("Cache is up to date")
DispatchQueue.main.async {
completionHandler(nil, error)
}
return
}
guard let infra = response.value, let lastModified = response.lastModified else {
log.error("No response from web service or missing Last-Modified")
DispatchQueue.main.async {
completionHandler(nil, error)