File tree Expand file tree Collapse file tree 1 file changed +2
-35
lines changed
Expand file tree Collapse file tree 1 file changed +2
-35
lines changed Original file line number Diff line number Diff line change 11/// A context object that carries additional information about an HTTP request.
22///
3- /// `HTTPRequestContext` provides a way to pass metadata and implementation-specific
4- /// information through the HTTP request pipeline. This is particularly useful when
5- /// you need to attach custom data that should be available throughout the request's
6- /// lifecycle.
7- ///
8- /// ## Implementation-Specific Data
9- ///
10- /// Different server implementations can store their own specific data by conforming to the
11- /// ``ImplementationSpecific`` protocol:
12- ///
13- /// ```swift
14- /// struct MyCustomContext: HTTPRequestContext.ImplementationSpecific {
15- /// let requestID: UUID
16- /// let startTime: Date
17- /// }
18- ///
19- /// var context = HTTPRequestContext()
20- /// context.implementationSpecific = MyCustomContext(
21- /// requestID: UUID(),
22- /// startTime: Date()
23- /// )
24- /// ```
25- public struct HTTPRequestContext : Sendable {
26-
27- /// Conform your custom types to this protocol to store implementation-specific
28- /// data within an ``HTTPRequestContext``.
29- public protocol ImplementationSpecific : Sendable { }
30-
31- /// Optional implementation-specific data associated with this request context.
32- ///
33- /// Use this property to store custom data that is specific to your HTTP
34- /// implementation. The stored value can be any type that conforms to
35- /// ``ImplementationSpecific``.
36- public var implementationSpecific : ( any ImplementationSpecific ) ?
37- }
3+ /// `HTTPRequestContext` provides a way to pass metadata through the HTTP request pipeline.
4+ public struct HTTPRequestContext : Sendable { }
You can’t perform that action at this time.
0 commit comments