@@ -71,15 +71,12 @@ public struct URLSessionTransport: ClientTransport {
71
71
/// - session: The URLSession used for performing HTTP operations.
72
72
/// - httpBodyProcessingMode: The mode used to process HTTP request and response bodies.
73
73
public init ( session: URLSession = . shared, httpBodyProcessingMode: HTTPBodyProcessingMode = . platformDefault) {
74
- self . session = session
75
74
let implementation = httpBodyProcessingMode. implementation
76
- if case . streaming = implementation {
77
- precondition ( Implementation . platformSupportsStreaming, " Streaming not supported on platform " )
78
- }
79
- self . implementation = implementation
75
+ self . init ( session: session, implementation: implementation)
80
76
}
81
77
/// Specifies the mode in which HTTP request and response bodies are processed.
82
- public struct HTTPBodyProcessingMode {
78
+
79
+ public struct HTTPBodyProcessingMode : Sendable {
83
80
/// Exposing the internal implementation directly.
84
81
fileprivate let implementation : Configuration . Implementation
85
82
@@ -98,6 +95,14 @@ public struct URLSessionTransport: ClientTransport {
98
95
}
99
96
100
97
var implementation : Implementation
98
+
99
+ init ( session: URLSession = . shared, implementation: Implementation = . platformDefault) {
100
+ self . session = session
101
+ if case . streaming = implementation {
102
+ precondition ( Implementation . platformSupportsStreaming, " Streaming not supported on platform " )
103
+ }
104
+ self . implementation = implementation
105
+ }
101
106
102
107
}
103
108
@@ -106,7 +111,7 @@ public struct URLSessionTransport: ClientTransport {
106
111
107
112
/// Creates a new URLSession-based transport.
108
113
/// - Parameter configuration: A set of configuration values used by the transport.
109
- public init ( configuration: Configuration = . init( ) ) { self . configuration = configuration }
114
+ public init ( configuration: Configuration = . init( httpBodyProcessingMode : . platformDefault ) ) { self . configuration = configuration }
110
115
111
116
/// Sends the underlying HTTP request and returns the received HTTP response.
112
117
/// - Parameters:
0 commit comments