We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 791c4c7 commit e41e2f3Copy full SHA for e41e2f3
1 file changed
Sources/OllamaKit/Utils/OKHTTPClient.swift
@@ -33,7 +33,14 @@ internal extension OKHTTPClient {
33
do {
34
let (bytes, response) = try await URLSession.shared.bytes(for: request)
35
try validate(response: response)
36
-
+
37
+ continuation.onTermination = { terminationState in
38
+ // Cancellation of our task should cancel the URLSessionDataTask
39
+ if case .cancelled = terminationState {
40
+ bytes.task.cancel()
41
+ }
42
43
44
var buffer = Data()
45
46
for try await byte in bytes {
0 commit comments