diff --git a/LeStorage/Services.swift b/LeStorage/Services.swift index 89854eb..3ef1118 100644 --- a/LeStorage/Services.swift +++ b/LeStorage/Services.swift @@ -207,7 +207,6 @@ public class Services { request.httpBody = apiCall.body.data(using: .utf8) request.setValue("application/json", forHTTPHeaderField: "Content-Type") - if let method = HTTPMethod(rawValue: apiCall.method), self._isTokenRequired(type: T.self, method: method) { do { let token = try self.keychainStore.getToken() diff --git a/LeStorage/StoredCollection.swift b/LeStorage/StoredCollection.swift index 737f4c0..b758845 100644 --- a/LeStorage/StoredCollection.swift +++ b/LeStorage/StoredCollection.swift @@ -352,7 +352,9 @@ public class StoredCollection: RandomAccessCollection, SomeCollecti do { let url: URL = try self._urlForJSONFile() - try FileManager.default.removeItem(at: url) + if FileManager.default.fileExists(atPath: url.path()) { + try FileManager.default.removeItem(at: url) + } } catch { Logger.error(error) }