Removed the force-unwrapped inside the "init(transport:)" initializer for the AmiiboLiveClient client in the library target.
This commit is contained in:
@@ -29,9 +29,12 @@ public struct AmiiboLiveClient: Sendable {
|
|||||||
/// Initializes this client with a transport for performing HTTP operations.
|
/// Initializes this client with a transport for performing HTTP operations.
|
||||||
/// - Parameter transport: A transport that performs HTTP operations. Defaults to a `URLSessionTransport` using the shared session.
|
/// - Parameter transport: A transport that performs HTTP operations. Defaults to a `URLSessionTransport` using the shared session.
|
||||||
public init(transport: any ClientTransport = URLSessionTransport()) {
|
public init(transport: any ClientTransport = URLSessionTransport()) {
|
||||||
|
guard let serverURL = try? Servers.Server1.url() else {
|
||||||
|
fatalError("The server URL defined in the OpenAPI specification could not be resolved. Verify that the 'openapi.yaml' server definition is valid.")
|
||||||
|
}
|
||||||
|
|
||||||
self.client = .init(
|
self.client = .init(
|
||||||
// The force unwrapping implemented below assumes that the server definition from the OpenAPI specification is correct.
|
serverURL: serverURL,
|
||||||
serverURL: try! Servers.Server1.url(),
|
|
||||||
configuration: .init(dateTranscoder: ISOTimestampTranscoder()),
|
configuration: .init(dateTranscoder: ISOTimestampTranscoder()),
|
||||||
transport: transport
|
transport: transport
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user