mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 03:23:08 +00:00
🪣 Use an ephemeral session
This commit is contained in:
parent
7a3a519e86
commit
33fa07ec1a
1 changed files with 7 additions and 1 deletions
|
@ -19,8 +19,14 @@ public class NetworkManager {
|
||||||
/// Designated initializer
|
/// Designated initializer
|
||||||
///
|
///
|
||||||
/// - Parameter session: A networking session.
|
/// - Parameter session: A networking session.
|
||||||
public init(session: NetworkSession = URLSession.shared) {
|
public init(session: NetworkSession = URLSession(configuration: .ephemeral)) {
|
||||||
self.session = session
|
self.session = session
|
||||||
|
|
||||||
|
// Older releases allowed URLSession to write a cache. We clean it up here.
|
||||||
|
do {
|
||||||
|
let url = URL(fileURLWithPath: NSHomeDirectory()).appendingPathComponent("Library/Caches/com.mphys.mas-cli")
|
||||||
|
try FileManager.default.removeItem(at: url)
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads data asynchronously.
|
/// Loads data asynchronously.
|
||||||
|
|
Loading…
Reference in a new issue