File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ final class RequestBag<Delegate: HTTPClientResponseDelegate> {
81
81
// MARK: - Request -
82
82
83
83
private func willExecuteRequest0( _ executor: HTTPRequestExecutor ) {
84
- guard self . state. willExecuteRequest ( executor) else {
84
+ self . task. eventLoop. assertInEventLoop ( )
85
+ if !self . state. willExecuteRequest ( executor) {
85
86
return executor. cancelRequest ( self )
86
87
}
87
88
}
@@ -240,6 +241,8 @@ final class RequestBag<Delegate: HTTPClientResponseDelegate> {
240
241
case . success:
241
242
self . consumeMoreBodyData0 ( resultOfPreviousConsume: $0)
242
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.
243
246
self . fail ( error)
244
247
}
245
248
}
You can’t perform that action at this time.
0 commit comments