We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f45596 commit d381066Copy full SHA for d381066
Sources/AsyncHTTPClient/RequestBag.swift
@@ -81,7 +81,8 @@ final class RequestBag<Delegate: HTTPClientResponseDelegate> {
81
// MARK: - Request -
82
83
private func willExecuteRequest0(_ executor: HTTPRequestExecutor) {
84
- guard self.state.willExecuteRequest(executor) else {
+ self.task.eventLoop.assertInEventLoop()
85
+ if !self.state.willExecuteRequest(executor) {
86
return executor.cancelRequest(self)
87
}
88
@@ -240,6 +241,8 @@ final class RequestBag<Delegate: HTTPClientResponseDelegate> {
240
241
case .success:
242
self.consumeMoreBodyData0(resultOfPreviousConsume: $0)
243
case .failure(let error):
244
+ // if in the response stream consumption an error has occurred, we need to
245
+ // cancel the running request and fail the task.
246
self.fail(error)
247
248
0 commit comments