@@ -25,18 +25,18 @@ public import HTTPTypes
2525/// ```
2626@available ( macOS 26 . 0 , iOS 26 . 0 , watchOS 26 . 0 , tvOS 26 . 0 , visionOS 26 . 0 , * )
2727public struct HTTPServerClosureRequestHandler <
28- ConcludingRequestReader: ConcludingAsyncReader < RequestReader , HTTPFields ? > & ~ Copyable,
28+ ConcludingRequestReader: ConcludingAsyncReader < RequestReader , HTTPFields ? > & ~ Copyable & SendableMetatype ,
2929 RequestReader: AsyncReader < Span < UInt8 > , any Error > & ~ Copyable,
30- ConcludingResponseWriter: ConcludingAsyncWriter < RequestWriter , HTTPFields ? > & ~ Copyable,
30+ ConcludingResponseWriter: ConcludingAsyncWriter < RequestWriter , HTTPFields ? > & ~ Copyable & SendableMetatype ,
3131 RequestWriter: AsyncWriter < Span < UInt8 > , any Error > & ~ Copyable
3232> : HTTPServerRequestHandler {
3333 /// The underlying closure that handles HTTP requests
3434 private let _handler :
3535 nonisolated( nonsending ) @Sendable (
3636 HTTPRequest,
3737 HTTPRequestContext,
38- consuming sending HTTPRequestConcludingAsyncReader ,
39- consuming sending HTTPResponseSender< HTTPResponseConcludingAsyncWriter >
38+ consuming sending ConcludingRequestReader ,
39+ consuming sending HTTPResponseSender< ConcludingResponseWriter >
4040 ) async throws -> Void
4141
4242 /// Creates a new closure-based HTTP request handler.
@@ -47,8 +47,8 @@ public struct HTTPServerClosureRequestHandler<
4747 handler: nonisolated( nonsending ) @Sendable @escaping (
4848 HTTPRequest,
4949 HTTPRequestContext,
50- consuming sending HTTPRequestConcludingAsyncReader ,
51- consuming sending HTTPResponseSender< HTTPResponseConcludingAsyncWriter >
50+ consuming sending ConcludingRequestReader ,
51+ consuming sending HTTPResponseSender< ConcludingResponseWriter >
5252 ) async throws -> Void
5353 ) {
5454 self . _handler = handler
@@ -66,20 +66,15 @@ public struct HTTPServerClosureRequestHandler<
6666 public func handle(
6767 request: HTTPRequest ,
6868 requestContext: HTTPRequestContext ,
69- requestBodyAndTrailers: consuming sending HTTPRequestConcludingAsyncReader ,
70- responseSender: consuming sending HTTPResponseSender< HTTPResponseConcludingAsyncWriter >
69+ requestBodyAndTrailers: consuming sending ConcludingRequestReader ,
70+ responseSender: consuming sending HTTPResponseSender< ConcludingResponseWriter >
7171 ) async throws {
7272 try await self . _handler ( request, requestContext, requestBodyAndTrailers, responseSender)
7373 }
7474}
7575
7676@available ( macOS 26 . 0 , iOS 26 . 0 , watchOS 26 . 0 , tvOS 26 . 0 , visionOS 26 . 0 , * )
77- extension HTTPServerProtocol where RequestHandler == HTTPServerClosureRequestHandler <
78- HTTPRequestConcludingAsyncReader ,
79- HTTPRequestConcludingAsyncReader . Underlying ,
80- HTTPResponseConcludingAsyncWriter ,
81- HTTPResponseConcludingAsyncWriter . Underlying
82- > {
77+ extension HTTPServerProtocol {
8378 /// Starts an HTTP server with a closure-based request handler.
8479 ///
8580 /// This method provides a convenient way to start an HTTP server using a closure to handle incoming requests.
@@ -108,8 +103,8 @@ extension HTTPServerProtocol where RequestHandler == HTTPServerClosureRequestHan
108103 handler: @Sendable @escaping (
109104 _ request: HTTPRequest ,
110105 _ requestContext: HTTPRequestContext ,
111- _ requestBodyAndTrailers: consuming sending HTTPRequestConcludingAsyncReader ,
112- _ responseSender: consuming sending HTTPResponseSender< HTTPResponseConcludingAsyncWriter >
106+ _ requestBodyAndTrailers: consuming sending RequestReader ,
107+ _ responseSender: consuming sending HTTPResponseSender< ResponseWriter >
113108 ) async throws -> Void
114109 ) async throws {
115110 try await self . serve ( handler: HTTPServerClosureRequestHandler ( handler: handler) )
0 commit comments