Skip to content

Commit d381066

Browse files
committed
Code review
1 parent 6f45596 commit d381066

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: Sources/AsyncHTTPClient/RequestBag.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ final class RequestBag<Delegate: HTTPClientResponseDelegate> {
8181
// MARK: - Request -
8282

8383
private func willExecuteRequest0(_ executor: HTTPRequestExecutor) {
84-
guard self.state.willExecuteRequest(executor) else {
84+
self.task.eventLoop.assertInEventLoop()
85+
if !self.state.willExecuteRequest(executor) {
8586
return executor.cancelRequest(self)
8687
}
8788
}
@@ -240,6 +241,8 @@ final class RequestBag<Delegate: HTTPClientResponseDelegate> {
240241
case .success:
241242
self.consumeMoreBodyData0(resultOfPreviousConsume: $0)
242243
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.
243246
self.fail(error)
244247
}
245248
}

0 commit comments

Comments
 (0)