After cancelling a Task, this preconditionFailure is triggered:
preconditionFailure(
"Tried to use a second iterator on response body stream. Multiple iterators are not supported.",
file: file, line: line
)
Workaround is to only call continuation.finish(throwing: error) in the catch block of stream(request:) in RequestHandler and remove this:
let data = try? await response.body.reduce(into: Data()) { $0.append(.init(buffer: $1)) }
After cancelling a Task, this preconditionFailure is triggered:
preconditionFailure( "Tried to use a second iterator on response body stream. Multiple iterators are not supported.", file: file, line: line )
Workaround is to only call
continuation.finish(throwing: error)
in the catch block ofstream(request:)
in RequestHandler and remove this:let data = try? await response.body.reduce(into: Data()) { $0.append(.init(buffer: $1)) }