We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee1305c commit 89f9a43Copy full SHA for 89f9a43
Tests/URLSession+AsyncTests.swift
@@ -47,4 +47,18 @@ final class URLSessionAsyncTests: XCTestCase {
47
208
48
)
49
}
50
+
51
+ func testURLSessionFallback_CancelsRequest() async throws {
52
+ let request = URLRequest(url: URL(string: "https://httpstat.us/200?sleep=10000")!)
53
54
+ let task = Task {
55
+ _ = try await URLSession.shared.makeData(for: request)
56
+ }
57
58
+ task.cancel()
59
60
+ await XCTAssertThrowsError(try await task.value, of: URLError.self) {
61
+ XCTAssertEqual($0.code, .cancelled)
62
63
64
0 commit comments