apple / swift-openapi-urlsession

URLSession transport for Swift OpenAPI Generator.
https://swiftpackageindex.com/apple/swift-openapi-urlsession/documentation
Apache License 2.0
160 stars 29 forks source link

More checks for task cancellation and tests #44

Closed simonjbeaumont closed 9 months ago

simonjbeaumont commented 9 months ago

Motivation

In our fallback, buffered implementation, we did not use a task cancellation handler so were not proactively cancelling the URLSession task when the Swift concurrency task was cancelled. Additionally, while we did have a task cancellation handler in the streaming implementation, so the URLSession task would be cancelled, we were not actively checking for task cancellation as often as we could.

Modifications

Result

More cooperative task and URLSession task cancellation and more thorough tests.

Test Plan

Added unit tests.