@@ -3,11 +3,11 @@ public import HTTPTypes
33/// A protocol that defines the contract for handling HTTP server requests.
44///
55/// ``HTTPServerRequestHandler`` provides a structured way to process incoming HTTP requests and generate appropriate responses.
6- /// Conforming types implement the ``handle(request:requestBodyAndTrailers:responseSender:)`` method,
6+ /// Conforming types implement the ``handle(request:requestContext: requestBodyAndTrailers:responseSender:)`` method,
77/// which is called by the HTTP server for each incoming request. The handler is responsible for:
88///
99/// - Processing the request headers.
10- /// - Reading the request body data using the provided ``HTTPRequestConcludingAsyncReader` `
10+ /// - Reading the request body data using the provided `RequestReader `
1111/// - Generating and sending an appropriate response using the response callback
1212///
1313/// This protocol fully supports bi-directional streaming HTTP request handling including the optional request and response trailers.
@@ -57,28 +57,30 @@ public import HTTPTypes
5757/// }
5858/// ```
5959@available ( macOS 26 . 0 , iOS 26 . 0 , watchOS 26 . 0 , tvOS 26 . 0 , visionOS 26 . 0 , * )
60- public protocol HTTPServerRequestHandler < ConcludingRequestReader , ConcludingResponseWriter > : Sendable {
60+ public protocol HTTPServerRequestHandler < RequestReader , ResponseWriter > : Sendable {
6161 /// The ``ConcludingAsyncReader`` to use when reading requests. ``ConcludingAsyncReader/FinalElement``
6262 /// must be an optional `HTTPFields`, and ``ConcludingAsyncReader/Underlying`` must use `Span<UInt8>` as its
6363 /// `ReadElement`.
64- associatedtype ConcludingRequestReader : ConcludingAsyncReader & ~ Copyable & SendableMetatype
65- where ConcludingRequestReader. Underlying. ReadElement == Span < UInt8 > , ConcludingRequestReader. FinalElement == HTTPFields ?
64+ associatedtype RequestReader : ConcludingAsyncReader & ~ Copyable & SendableMetatype
65+ where RequestReader. Underlying. ReadElement == Span < UInt8 > ,
66+ RequestReader. FinalElement == HTTPFields ?
6667
67- /// The ``ConcludingAsyncWriter`` to use when reading requests . ``ConcludingAsyncWriter/FinalElement``
68+ /// The ``ConcludingAsyncWriter`` to use when writing responses . ``ConcludingAsyncWriter/FinalElement``
6869 /// must be an optional `HTTPFields`, and ``ConcludingAsyncWriter/Underlying`` must use `Span<UInt8>` as its
6970 /// `WriteElement`.
70- associatedtype ConcludingResponseWriter : ConcludingAsyncWriter & ~ Copyable & SendableMetatype
71- where ConcludingResponseWriter. Underlying. WriteElement == Span < UInt8 > , ConcludingResponseWriter. FinalElement == HTTPFields ?
71+ associatedtype ResponseWriter : ConcludingAsyncWriter & ~ Copyable & SendableMetatype
72+ where ResponseWriter. Underlying. WriteElement == Span < UInt8 > ,
73+ ResponseWriter. FinalElement == HTTPFields ?
7274
7375 /// Handles an incoming HTTP request and generates a response.
7476 ///
7577 /// This method is called by the HTTP server for each incoming client request. Implementations should:
7678 /// 1. Examine the request headers in the `request` parameter
77- /// 2. Read the request body data from the ``RequestConcludingAsyncReader` ` as needed
79+ /// 2. Read the request body data from the `RequestReader ` as needed
7880 /// 3. Process the request and prepare a response
7981 /// 4. Optionally call ``HTTPResponseSender/sendInformational(_:)`` as needed
8082 /// 4. Call the ``HTTPResponseSender/send(_:)`` with an appropriate HTTP response
81- /// 5. Write the response body data to the returned ``HTTPResponseConcludingAsyncWriter` `
83+ /// 5. Write the response body data to the returned `ResponseWriter `
8284 ///
8385 /// - Parameters:
8486 /// - request: The HTTP request headers and metadata.
@@ -93,7 +95,7 @@ public protocol HTTPServerRequestHandler<ConcludingRequestReader, ConcludingResp
9395 func handle(
9496 request: HTTPRequest ,
9597 requestContext: HTTPRequestContext ,
96- requestBodyAndTrailers: consuming sending ConcludingRequestReader ,
97- responseSender: consuming sending HTTPResponseSender< ConcludingResponseWriter >
98+ requestBodyAndTrailers: consuming sending RequestReader ,
99+ responseSender: consuming sending HTTPResponseSender< ResponseWriter >
98100 ) async throws
99101}
0 commit comments