Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/APIKit/SessionAdapter/URLSessionAdapter.swift
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,7 +68,7 @@ open class URLSessionAdapter: NSObject, SessionAdapter, URLSessionDelegate, URLS
}

private func progressHandler(for task: URLSessionTask) -> ((Int64, Int64, Int64) -> Void)? {
return objc_getAssociatedObject(task, &taskAssociatedObjectCompletionHandlerKey) as? (Int64, Int64, Int64) -> Void
return objc_getAssociatedObject(task, &taskAssociatedObjectProgressHandlerKey) as? (Int64, Int64, Int64) -> Void
}
// MARK: URLSessionTaskDelegate
open func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -64,14 +64,9 @@ class URLSessionAdapterSubclassTests: XCTestCase {
let adapter = SessionAdapter(configuration: configuration)
let session = Session(adapter: adapter)

session.send(request,
completionHandler: { result in
if case .failure = result {
XCTFail()
}

expectation.fulfill()
})
session.send(request, progressHandler: { _, _, _ in
expectation.fulfill()
})

waitForExpectations(timeout: 10.0, handler: nil)
XCTAssertEqual(adapter.functionCallFlags["urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)"], true)
Expand Down