From 94dbbf172693e2467e50d4fad5bd4cb38ae7d5d8 Mon Sep 17 00:00:00 2001 From: Kabir Oberai Date: Tue, 24 Dec 2024 02:54:09 +0530 Subject: [PATCH] Use more HTTPTypes --- Package.swift | 3 + .../DeveloperServicesClient.swift | 34 ++++--- .../GrandSlam/Anisette/ADIDataProvider.swift | 30 +++---- .../Anisette/OmnisetteADIProvider.swift | 12 +-- .../Anisette/SupersetteADIProvider.swift | 2 +- .../Supersign/GrandSlam/GrandSlamClient.swift | 20 ++--- .../Lookup/GrandSlamLookupManager.swift | 19 ++-- .../Requests/GrandSlamOperationRequest.swift | 4 +- .../GrandSlam/Requests/GrandSlamRequest.swift | 6 +- .../Requests/GrandSlamTwoFactorRequest.swift | 14 +-- .../AsyncHTTPClient+HTTP.swift | 32 ------- .../HTTPClientProtocol.swift | 90 +++++++++---------- .../HTTPClientProtocol/URLSession+HTTP.swift | 76 ---------------- .../SupersignCLISupport/DevSDKCommand.swift | 2 +- 14 files changed, 112 insertions(+), 232 deletions(-) diff --git a/Package.swift b/Package.swift index 66b4f9f8..9ee2f8b5 100644 --- a/Package.swift +++ b/Package.swift @@ -33,6 +33,7 @@ let package = Package( .package(url: "https://github.com/kabiroberai/zsign", .upToNextMinor(from: "1.3.0")), .package(url: "https://github.com/apple/swift-system", from: "1.4.0"), + .package(url: "https://github.com/apple/swift-http-types", from: "1.3.1"), .package(url: "https://github.com/apple/swift-certificates", from: "1.0.0"), .package(url: "https://github.com/apple/swift-crypto", from: "3.9.1"), .package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"), @@ -84,6 +85,8 @@ let package = Package( .product(name: "_CryptoExtras", package: "swift-crypto"), .product(name: "X509", package: "swift-certificates"), .product(name: "BigInt", package: "BigInt"), + .product(name: "HTTPTypes", package: "swift-http-types"), + .product(name: "HTTPTypesFoundation", package: "swift-http-types"), .product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"), .product( name: "OpenAPIAsyncHTTPClient", diff --git a/Sources/Supersign/DeveloperServices/DeveloperServicesClient.swift b/Sources/Supersign/DeveloperServices/DeveloperServicesClient.swift index 2261e24c..f34f0443 100644 --- a/Sources/Supersign/DeveloperServices/DeveloperServicesClient.swift +++ b/Sources/Supersign/DeveloperServices/DeveloperServicesClient.swift @@ -78,34 +78,30 @@ public struct DeveloperServicesClient: Sendable { let deviceInfo = try deviceInfoProvider.fetch() - var httpRequest = HTTPRequest(url: url, method: "POST") + var httpRequest = HTTPRequest(method: .post, url: url) let acceptedLanguages = Locale.preferredLanguages.joined(separator: ", ") - httpRequest.headers["Accept-Language"] = acceptedLanguages - httpRequest.headers["Accept"] = request.apiVersion.accept - httpRequest.headers["Content-Type"] = request.apiVersion.contentType - httpRequest.headers["User-Agent"] = "Xcode" - request.methodOverride.map { httpRequest.headers["X-HTTP-Method-Override"] = $0 } + httpRequest.headerFields[.acceptLanguage] = acceptedLanguages + httpRequest.headerFields[.accept] = request.apiVersion.accept + httpRequest.headerFields[.contentType] = request.apiVersion.contentType + httpRequest.headerFields[.userAgent] = "Xcode" + request.methodOverride.map { httpRequest.headerFields[.init("X-HTTP-Method-Override")!] = $0 } - httpRequest.headers[DeviceInfo.xcodeVersionKey] = DeviceInfo.xcodeVersion - httpRequest.headers[DeviceInfo.clientInfoKey] = deviceInfo.clientInfo.clientString - httpRequest.headers[DeviceInfo.deviceIDKey] = deviceInfo.deviceID + httpRequest.headerFields[.init(DeviceInfo.xcodeVersionKey)!] = DeviceInfo.xcodeVersion + httpRequest.headerFields[.init(DeviceInfo.clientInfoKey)!] = deviceInfo.clientInfo.clientString + httpRequest.headerFields[.init(DeviceInfo.deviceIDKey)!] = deviceInfo.deviceID - httpRequest.headers["X-Apple-I-Identity-Id"] = loginToken.adsid - httpRequest.headers["X-Apple-App-Info"] = AppTokenKey.xcode.rawValue - httpRequest.headers["X-Apple-GS-Token"] = loginToken.token + httpRequest.headerFields[.init("X-Apple-I-Identity-Id")!] = loginToken.adsid + httpRequest.headerFields[.init("X-Apple-App-Info")!] = AppTokenKey.xcode.rawValue + httpRequest.headerFields[.init("X-Apple-GS-Token")!] = loginToken.token - anisetteData.dictionary.forEach { httpRequest.headers[$0] = $1 } - - httpRequest.body = try .buffer(request.apiVersion.body(withParameters: request.parameters)) + anisetteData.dictionary.forEach { httpRequest.headerFields[.init($0)!] = $1 } request.configure(urlRequest: &httpRequest) - let resp = try await httpClient.makeRequest(httpRequest) + let body = try request.apiVersion.body(withParameters: request.parameters) - // we don't throw if data is nil because sometimes no data is - // okay (eg in the case of EmptyResponse) - let data = resp.body ?? Data() + let (_, data) = try await httpClient.makeRequest(httpRequest, body: body) // String(data: data, encoding: .utf8).map { print("\(url): \($0)") } diff --git a/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swift b/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swift index 5f70aeaa..705e30a2 100644 --- a/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swift +++ b/Sources/Supersign/GrandSlam/Anisette/ADIDataProvider.swift @@ -167,29 +167,25 @@ public struct ADIDataProvider: AnisetteDataProvider { let body = try Self.encoder.encode(GSARequest(request: request)) - var request = HTTPRequest( - url: endpointURL, - method: "POST", - headers: [ - "Content-Type": "text/x-xml-plist", - AnisetteData.localUserIDKey: self.localUserID, - "Accept-Language": "en_US" - ], - body: .buffer(body) - ) - request.headers["X-MMe-Country"] = Locale.current.regionCode + var request = HTTPRequest(url: endpointURL) + request.method = .post + request.headerFields = [ + .contentType: "text/x-xml-plist", + .acceptLanguage: "en_US", + .init(AnisetteData.localUserIDKey)!: self.localUserID, + ] + request.headerFields[.init("X-MMe-Country")!] = Locale.current.regionCode - request.headers[DeviceInfo.clientInfoKey] = try await clientInfo() - request.headers[DeviceInfo.deviceIDKey] = self.localUserUID.uuidString + request.headerFields[.init(DeviceInfo.clientInfoKey)!] = try await clientInfo() + request.headerFields[.init(DeviceInfo.deviceIDKey)!] = self.localUserUID.uuidString // request.headers[DeviceInfo.clientInfoKey] = self.deviceInfo.clientInfo.clientString // self.deviceInfo.dictionary.forEach { request.headers[$0] = $1 } - let resp = try await self.httpClient.makeRequest(request) + let (_, response) = try await self.httpClient.makeRequest(request, body: body) - guard let body = resp.body else { throw ADIError.noResponse } -// print(String(data: body, encoding: .utf8) ?? "") +// print(String(data: response, encoding: .utf8) ?? "") - return try GrandSlamOperationDecoder.decode(data: body) + return try GrandSlamOperationDecoder.decode(data: response) } private func endProvisioning( diff --git a/Sources/Supersign/GrandSlam/Anisette/OmnisetteADIProvider.swift b/Sources/Supersign/GrandSlam/Anisette/OmnisetteADIProvider.swift index 197fef86..63eaefba 100644 --- a/Sources/Supersign/GrandSlam/Anisette/OmnisetteADIProvider.swift +++ b/Sources/Supersign/GrandSlam/Anisette/OmnisetteADIProvider.swift @@ -34,7 +34,7 @@ struct OmnisetteADIProvider: RawADIProvider { } let body = try await client.makeRequest( HTTPRequest(url: url.appendingPathComponent("v3/client_info")) - ).body ?? Data() + ).body let clientInfo = try Self.decoder.decode(ClientInfo.self, from: body) return clientInfo.clientInfo } @@ -74,13 +74,13 @@ struct OmnisetteADIProvider: RawADIProvider { } var request = HTTPRequest(url: url.appendingPathComponent("v3/get_headers")) - request.method = "POST" - request.body = .buffer(try Self.encoder.encode(Request( + request.method = .post + request.headerFields[.contentType] = "application/json" + let body = try Self.encoder.encode(Request( identifier: userID.rawBytes, adiPb: provisioningInfo - ))) - request.headers["Content-Type"] = "application/json" - let response = try await client.makeRequest(request).body ?? Data() + )) + let response = try await client.makeRequest(request, body: body).body let decoded = try Self.decoder.decode(Response.self, from: response) if let rinfo = UInt64(decoded.rinfo) { routingInfo = rinfo diff --git a/Sources/Supersign/GrandSlam/Anisette/SupersetteADIProvider.swift b/Sources/Supersign/GrandSlam/Anisette/SupersetteADIProvider.swift index d34989ba..ecd1af00 100644 --- a/Sources/Supersign/GrandSlam/Anisette/SupersetteADIProvider.swift +++ b/Sources/Supersign/GrandSlam/Anisette/SupersetteADIProvider.swift @@ -31,7 +31,7 @@ public actor SupersetteADIProvider: RawADIProvider { let progString = "\(Int(progress * 100))%".padding(toLength: 4, leading: true) print("\r[Downloading libraries] \(progString)", terminator: "") fflush(stdoutSafe) - }.body! + }.body try data.write(to: applemusic) } diff --git a/Sources/Supersign/GrandSlam/GrandSlamClient.swift b/Sources/Supersign/GrandSlam/GrandSlamClient.swift index d9275cd6..f44682c8 100644 --- a/Sources/Supersign/GrandSlam/GrandSlamClient.swift +++ b/Sources/Supersign/GrandSlam/GrandSlamClient.swift @@ -28,23 +28,21 @@ struct GrandSlamClient: Sendable { let url = try await lookupManager.fetchURL(forEndpoint: R.endpoint) let method = request.method(deviceInfo: deviceInfo, anisetteData: anisetteData) - var httpRequest = HTTPRequest(url: url, method: method.name) - httpRequest.headers = [ - "Content-Type": "text/x-xml-plist", - DeviceInfo.clientInfoKey: deviceInfo.clientInfo.clientString - ] - switch method { + var httpRequest = HTTPRequest(method: method.httpMethod, url: url) + httpRequest.headerFields[.contentType] = "text/x-xml-plist" + httpRequest.headerFields[.init(DeviceInfo.clientInfoKey)!] = deviceInfo.clientInfo.clientString + let body: Data? = switch method { case .get: - break + nil case .post(let body): - httpRequest.body = try .buffer(PropertyListSerialization.data( + try PropertyListSerialization.data( fromPropertyList: body, format: .xml, options: 0 - )) + ) } request.configure(request: &httpRequest, deviceInfo: deviceInfo, anisetteData: anisetteData) - let resp = try await httpClient.makeRequest(httpRequest) - return try R.Decoder.decode(data: resp.body ?? .init()) + let resp = try await httpClient.makeRequest(httpRequest, body: body) + return try R.Decoder.decode(data: resp.body) } } diff --git a/Sources/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swift b/Sources/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swift index ca735a78..f3c5304c 100644 --- a/Sources/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swift +++ b/Sources/Supersign/GrandSlam/Lookup/GrandSlamLookupManager.swift @@ -8,6 +8,7 @@ import Foundation import Dependencies +import HTTPTypesFoundation actor GrandSlamLookupManager { @@ -37,18 +38,18 @@ actor GrandSlamLookupManager { "X-Mme-Device-Id" = "[REDACTED]"; } */ var request = HTTPRequest(url: Self.lookupURL) - request.headers = [ - DeviceInfo.clientInfoKey: deviceInfo.clientInfo.clientString, - DeviceInfo.deviceIDKey: deviceInfo.deviceID, - AnisetteData.iLocaleKey: Locale.current.identifier, - AnisetteData.timeZoneKey: TimeZone.current.identifier, - "X-Apple-I-TimeZone-Offset": "\(TimeZone.current.secondsFromGMT())" + request.headerFields = [ + .init(DeviceInfo.clientInfoKey)!: deviceInfo.clientInfo.clientString, + .init(DeviceInfo.deviceIDKey)!: deviceInfo.deviceID, + .init(AnisetteData.iLocaleKey)!: Locale.current.identifier, + .init(AnisetteData.timeZoneKey)!: TimeZone.current.identifier, + .init("X-Apple-I-TimeZone-Offset")!: "\(TimeZone.current.secondsFromGMT())" ] - request.headers["X-MMe-Country"] = Locale.current.regionCode + request.headerFields[.init("X-MMe-Country")!] = Locale.current.regionCode - let resp = try await httpClient.makeRequest(request) + let (_, body) = try await httpClient.makeRequest(request) - return try self.decoder.decode(Response.self, from: resp.body ?? .init()).urls + return try self.decoder.decode(Response.self, from: body).urls } private func fetchEndpoints() async throws -> GrandSlamEndpoints { diff --git a/Sources/Supersign/GrandSlam/Requests/GrandSlamOperationRequest.swift b/Sources/Supersign/GrandSlam/Requests/GrandSlamOperationRequest.swift index 11faef48..ef4196a3 100644 --- a/Sources/Supersign/GrandSlam/Requests/GrandSlamOperationRequest.swift +++ b/Sources/Supersign/GrandSlam/Requests/GrandSlamOperationRequest.swift @@ -70,8 +70,8 @@ extension GrandSlamOperationRequest { static var endpoint: GrandSlamEndpoint { .lookup(\.gsService) } func configure(request: inout HTTPRequest, deviceInfo: DeviceInfo, anisetteData: AnisetteData) { - request.headers["Accept"] = "*/*" - request.headers["User-Agent"] = deviceInfo.clientInfo.userAgent + request.headerFields[.accept] = "*/*" + request.headerFields[.userAgent] = deviceInfo.clientInfo.userAgent } func method(deviceInfo: DeviceInfo, anisetteData: AnisetteData) -> GrandSlamMethod { diff --git a/Sources/Supersign/GrandSlam/Requests/GrandSlamRequest.swift b/Sources/Supersign/GrandSlam/Requests/GrandSlamRequest.swift index 2b4578f6..5e76b1b7 100644 --- a/Sources/Supersign/GrandSlam/Requests/GrandSlamRequest.swift +++ b/Sources/Supersign/GrandSlam/Requests/GrandSlamRequest.swift @@ -12,10 +12,10 @@ enum GrandSlamMethod { case get case post([String: Any]) - var name: String { + var httpMethod: HTTPRequest.Method { switch self { - case .get: return "GET" - case .post: return "POST" + case .get: return .get + case .post: return .post } } } diff --git a/Sources/Supersign/GrandSlam/Requests/GrandSlamTwoFactorRequest.swift b/Sources/Supersign/GrandSlam/Requests/GrandSlamTwoFactorRequest.swift index a8861f5c..653da608 100644 --- a/Sources/Supersign/GrandSlam/Requests/GrandSlamTwoFactorRequest.swift +++ b/Sources/Supersign/GrandSlam/Requests/GrandSlamTwoFactorRequest.swift @@ -18,13 +18,13 @@ extension GrandSlamTwoFactorRequest { var extraHeaders: [String: String] { [:] } func configure(request: inout HTTPRequest, deviceInfo: DeviceInfo, anisetteData: AnisetteData) { - request.headers["Accept"] = "application/x-buddyml" - request.headers["Content-Type"] = "application/x-plist" - request.headers["X-Apple-App-Info"] = "com.apple.gs.xcode.auth" - request.headers[DeviceInfo.xcodeVersionKey] = DeviceInfo.xcodeVersion - request.headers["X-Apple-Identity-Token"] = loginData.identityToken - anisetteData.dictionary.forEach { request.headers[$0] = $1 } - extraHeaders.forEach { request.headers[$0] = $1 } + request.headerFields[.accept] = "application/x-buddyml" + request.headerFields[.contentType] = "application/x-plist" + request.headerFields[.init("X-Apple-App-Info")!] = "com.apple.gs.xcode.auth" + request.headerFields[.init(DeviceInfo.xcodeVersionKey)!] = DeviceInfo.xcodeVersion + request.headerFields[.init("X-Apple-Identity-Token")!] = loginData.identityToken + anisetteData.dictionary.forEach { request.headerFields[.init($0)!] = $1 } + extraHeaders.forEach { request.headerFields[.init($0)!] = $1 } } func method(deviceInfo: DeviceInfo, anisetteData: AnisetteData) -> GrandSlamMethod { diff --git a/Sources/Supersign/HTTPClientProtocol/AsyncHTTPClient+HTTP.swift b/Sources/Supersign/HTTPClientProtocol/AsyncHTTPClient+HTTP.swift index 4026845f..e7cf56fb 100644 --- a/Sources/Supersign/HTTPClientProtocol/AsyncHTTPClient+HTTP.swift +++ b/Sources/Supersign/HTTPClientProtocol/AsyncHTTPClient+HTTP.swift @@ -33,38 +33,6 @@ extension HTTPClientDependencyKey: DependencyKey { } extension HTTPClient: HTTPClientProtocol { - @discardableResult - public func makeRequest(_ request: HTTPRequest, onProgress: sending @isolated(any) (Double?) -> Void) async throws -> HTTPResponse { -// print("Requesting \(request.url)") - var httpRequest = HTTPClientRequest(url: request.url.absoluteString) - httpRequest.method = request.method.map(HTTPMethod.init(rawValue:)) ?? .GET - httpRequest.headers = HTTPHeaders(request.headers.map { $0 }) - httpRequest.body = switch request.body { - case .buffer(let data): - .bytes(data) - case nil: - nil - } - let response = try await execute(httpRequest, deadline: .distantFuture) - let expectedBytes = response.headers.first(name: "content-length").flatMap(Int.init).map(Double.init) - if expectedBytes == nil { - await onProgress(nil) - } - var body = Data() - for try await chunk in response.body { - body += chunk.readableBytesView - if let expectedBytes { - await onProgress(min(Double(body.count) / expectedBytes, 1)) - } - } - return HTTPResponse( - url: request.url, - status: Int(response.status.code), - headers: [:], - body: body - ) - } - public func makeWebSocket(url: URL) async throws -> any WebSocketSession { let (stream, continuation) = AsyncStream.makeStream(of: WebSocketSessionWrapper.self) async let value = stream.first(where: { _ in true }) diff --git a/Sources/Supersign/HTTPClientProtocol/HTTPClientProtocol.swift b/Sources/Supersign/HTTPClientProtocol/HTTPClientProtocol.swift index 79c25f8d..76aa7b06 100644 --- a/Sources/Supersign/HTTPClientProtocol/HTTPClientProtocol.swift +++ b/Sources/Supersign/HTTPClientProtocol/HTTPClientProtocol.swift @@ -10,62 +10,56 @@ import OpenAPIRuntime import Dependencies import HTTPTypes -public struct HTTPRequest: Sendable { - public enum Body: Sendable { - case buffer(Data) - } - - public var url: URL - public var method: String? - public var headers: [String: String] - public var body: Body? - - public init( - url: URL, - method: String? = nil, - headers: [String: String] = [:], - body: Body? = nil - ) { - self.url = url - self.method = method - self.headers = headers - self.body = body - } -} - -public struct HTTPResponse: Sendable { - public var url: URL - public var status: Int - public var headers: [String: String] - public var body: Data? - - public init( - url: URL, - status: Int, - headers: [String: String] = [:], - body: Data? = nil - ) { - self.url = url - self.status = status - self.headers = headers - self.body = body - } -} +public typealias HTTPRequest = HTTPTypes.HTTPRequest +public typealias HTTPResponse = HTTPTypes.HTTPResponse +public typealias HTTPBody = OpenAPIRuntime.HTTPBody public protocol HTTPClientProtocol: Sendable { var asOpenAPITransport: ClientTransport { get } - func makeRequest( - _ request: HTTPRequest, - onProgress: sending @isolated(any) (Double?) -> Void - ) async throws -> HTTPResponse - func makeWebSocket(url: URL) async throws -> WebSocketSession } extension HTTPClientProtocol { - public func makeRequest(_ request: HTTPRequest) async throws -> HTTPResponse { - try await makeRequest(request) { _ in } + public func send( + _ request: HTTPRequest, + body: HTTPBody? = nil + ) async throws -> (response: HTTPResponse, body: HTTPBody?) { + let transport = asOpenAPITransport + let request = request + var baseComponents = URLComponents() + baseComponents.scheme = request.scheme + baseComponents.host = request.authority + return try await transport.send( + request, + body: body, + baseURL: baseComponents.url!, + operationID: "dummy" + ) + } + + public func makeRequest( + _ request: HTTPRequest, + body: Data? = nil, + onProgress: sending @isolated(any) (Double?) -> Void = { _ in } + ) async throws -> (response: HTTPResponse, body: Data) { + await onProgress(0) + let (response, body) = try await send(request, body: body.map { HTTPBody($0) }) + guard let body else { + return (response, Data()) + } + switch body.length { + case .unknown: + return (response, try await body.reduce(into: Data()) { $0 += $1 }) + case .known(let length): + var data = Data(capacity: Int(length)) + let total = Double(length) + for try await chunk in body { + data += chunk + await onProgress(min(Double(data.count) / total, 1)) + } + return (response, data) + } } } diff --git a/Sources/Supersign/HTTPClientProtocol/URLSession+HTTP.swift b/Sources/Supersign/HTTPClientProtocol/URLSession+HTTP.swift index 781bcc45..1663392d 100644 --- a/Sources/Supersign/HTTPClientProtocol/URLSession+HTTP.swift +++ b/Sources/Supersign/HTTPClientProtocol/URLSession+HTTP.swift @@ -56,82 +56,6 @@ private final class Client: HTTPClientProtocol { URLSessionTransport(configuration: .init(session: session)) } - public func makeRequest( - _ request: HTTPRequest, - onProgress: sending @isolated(any) (Double?) -> Void - ) async throws -> HTTPResponse { - final class ProgressDelegate: NSObject, URLSessionDataDelegate { - private let progressContinuation: AsyncStream.Continuation - let progressStream: AsyncStream - - @MainActor private var count = 0 - - override init() { - (progressStream, progressContinuation) = AsyncStream.makeStream( - // it's okay to skip missed progress updates - bufferingPolicy: .bufferingNewest(1) - ) - } - - func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) { - let count = MainActor.assumeIsolated { - self.count += data.count - return self.count - } - if let contentLength = dataTask.response?.expectedContentLength, contentLength != -1 { - let progress = min(Double(count) / Double(contentLength), 1) - progressContinuation.yield(progress) - } - } - - func finish() { - progressContinuation.finish() - } - } - - var req = URLRequest(url: request.url) - req.httpMethod = request.method - request.headers.forEach { k, v in - req.setValue(v, forHTTPHeaderField: k) - } - switch request.body { - case .buffer(let data): - req.httpBody = data - case nil: - break - } - - let delegate = ProgressDelegate() - async let progressWatcher: Void = { - for await progress in delegate.progressStream { - await onProgress(progress) - } - }() - let (data, response) = if #available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) { - try await session.data(for: req, delegate: delegate) - } else { - try await session.data(for: req) - } - delegate.finish() - _ = await progressWatcher - - guard let httpResp = response as? HTTPURLResponse else { throw UnknownHTTPError() } - let headers = [String: String]( - uniqueKeysWithValues: httpResp.allHeaderFields.compactMap { k, v in - guard let kStr = k as? String, - let vStr = v as? String - else { return nil } - return (kStr, vStr) - } - ) - return HTTPResponse( - url: request.url, - status: httpResp.statusCode, - headers: headers, - body: data - ) - } - public func makeWebSocket(url: URL) async throws -> any WebSocketSession { let task = session.webSocketTask(with: url) let (event, eventContinuation) = AsyncStream.makeStream() diff --git a/Sources/SupersignCLISupport/DevSDKCommand.swift b/Sources/SupersignCLISupport/DevSDKCommand.swift index 43c6fc2a..70852f00 100644 --- a/Sources/SupersignCLISupport/DevSDKCommand.swift +++ b/Sources/SupersignCLISupport/DevSDKCommand.swift @@ -77,7 +77,7 @@ struct DarwinSDKVersions: Decodable { static func all() async throws -> DarwinSDKVersions { @Dependency(\.httpClient) var httpClient - let data = try await httpClient.makeRequest(HTTPRequest(url: url)).body ?? Data() + let data = try await httpClient.makeRequest(HTTPRequest(url: url)).body return try decoder.decode(self, from: data) } }