You are creating an unstructured task in that code and giving it to DataTask<Value>
. You must manually cancel that task.
That doesn't happen in this code:
let task = Task {
_ = await request.decode(TestResponse.self).response
}
task.cancel()