mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Convert several methods to async await.
This commit is contained in:
@@ -66,6 +66,21 @@ extension Transport {
|
||||
}
|
||||
}
|
||||
|
||||
public func send<P: Encodable & Sendable>(request: URLRequest, method: String, payload: P) async throws {
|
||||
|
||||
try await withCheckedThrowingContinuation { continuation in
|
||||
|
||||
self.send(request: request, method: method, payload: payload) { result in
|
||||
switch result {
|
||||
case .success:
|
||||
continuation.resume()
|
||||
case .failure(let error):
|
||||
continuation.resume(throwing: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sends the specified HTTP method with a JSON payload.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user