From ad43ee95173fe79db868712c2e0fec385e88f96f Mon Sep 17 00:00:00 2001 From: Honza Dvorsky Date: Fri, 15 Sep 2023 17:14:18 +0200 Subject: [PATCH] Make the input HTTPClient required --- .../AsyncHTTPClientTransport.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/OpenAPIAsyncHTTPClient/AsyncHTTPClientTransport.swift b/Sources/OpenAPIAsyncHTTPClient/AsyncHTTPClientTransport.swift index 748c093..9b0b955 100644 --- a/Sources/OpenAPIAsyncHTTPClient/AsyncHTTPClientTransport.swift +++ b/Sources/OpenAPIAsyncHTTPClient/AsyncHTTPClientTransport.swift @@ -32,7 +32,13 @@ import protocol Foundation.LocalizedError /// /// Instantiate the transport: /// -/// let transport = AsyncHTTPClientTransport() +/// let httpClient = HTTPClient() +/// defer { +/// try! httpClient.syncShutdown() +/// } +/// let transport = AsyncHTTPClientTransport( +/// configuration: .init(client: httpClient) +/// ) /// /// Create the base URL of the server to call using your client. If the server /// URL was defined in the OpenAPI document, you find a generated method for it @@ -75,7 +81,7 @@ public struct AsyncHTTPClientTransport: ClientTransport { /// - Parameters: /// - client: The underlying client used to perform HTTP operations. /// - timeout: The request timeout, defaults to 1 minute. - public init(client: HTTPClient = .init(), timeout: TimeAmount = .minutes(1)) { + public init(client: HTTPClient, timeout: TimeAmount = .minutes(1)) { self.client = client self.timeout = timeout }