mirror of
https://github.com/swift-server/async-http-client.git
synced 2026-06-02 07:37:34 +00:00
Add "debug initializer" hook for channels (#801)
Motivation: As requested in #596, it can be handy to have a lower-level access to channels (HTTP/1 connection, HTTP/2 connection, or HTTP/2 stream) to enable a more fine-grained interaction for, say, observability, testing, etc. Modifications: - Add 3 new properties (`http1_1ConnectionDebugInitializer`, `http2ConnectionDebugInitializer` and `http2StreamChannelDebugInitializer`) to `HTTPClient.Configuration` with access to the respective channels. These properties are of `Optional` type `@Sendable (Channel) -> EventLoopFuture<Void>` and are called when creating a connection/stream. Result: Provides APIs for a lower-level access to channels. --------- Co-authored-by: Cory Benfield <lukasa@apple.com> Co-authored-by: David Nadoba <d_nadoba@apple.com> Co-authored-by: George Barnett <gbarnett@apple.com>
This commit is contained in:
@@ -324,7 +324,9 @@ final class HTTPConnectionPool:
|
||||
connection.executeRequest(request.req)
|
||||
|
||||
case .executeRequests(let requests, let connection):
|
||||
for request in requests { connection.executeRequest(request.req) }
|
||||
for request in requests {
|
||||
connection.executeRequest(request.req)
|
||||
}
|
||||
|
||||
case .failRequest(let request, let error):
|
||||
request.req.fail(error)
|
||||
|
||||
Reference in New Issue
Block a user