Skip to content

Commit fb49a88

Browse files
committed
fixing testing issues
1 parent a1b1562 commit fb49a88

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

Sources/OpenAPIURLSession/URLSessionTransport.swift

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,12 @@ public struct URLSessionTransport: ClientTransport {
7171
/// - session: The URLSession used for performing HTTP operations.
7272
/// - httpBodyProcessingMode: The mode used to process HTTP request and response bodies.
7373
public init(session: URLSession = .shared, httpBodyProcessingMode: HTTPBodyProcessingMode = .platformDefault) {
74-
self.session = session
7574
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)
8076
}
8177
/// Specifies the mode in which HTTP request and response bodies are processed.
82-
public struct HTTPBodyProcessingMode {
78+
79+
public struct HTTPBodyProcessingMode: Sendable {
8380
/// Exposing the internal implementation directly.
8481
fileprivate let implementation: Configuration.Implementation
8582

@@ -98,6 +95,14 @@ public struct URLSessionTransport: ClientTransport {
9895
}
9996

10097
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+
}
101106

102107
}
103108

@@ -106,7 +111,7 @@ public struct URLSessionTransport: ClientTransport {
106111

107112
/// Creates a new URLSession-based transport.
108113
/// - 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 }
110115

111116
/// Sends the underlying HTTP request and returns the received HTTP response.
112117
/// - Parameters:

0 commit comments

Comments
 (0)