Mark Transport as Sendable.

This commit is contained in:
Brent Simmons 2024-04-06 12:05:53 -07:00
parent 61af38fabf
commit cee961cfa5

View File

@ -114,12 +114,13 @@ public enum TransportError: LocalizedError {
} }
public protocol Transport { public protocol Transport: Sendable {
/// Cancels all pending requests /// Cancels all pending requests
func cancelAll() func cancelAll()
/// Sends URLRequest and returns the HTTP headers and the data payload. /// Sends URLRequest and returns the HTTP headers and the data payload.
@discardableResult
func send(request: URLRequest) async throws -> (HTTPURLResponse, Data?) func send(request: URLRequest) async throws -> (HTTPURLResponse, Data?)
func send(request: URLRequest, completion: @escaping (Result<(HTTPURLResponse, Data?), Error>) -> Void) func send(request: URLRequest, completion: @escaping (Result<(HTTPURLResponse, Data?), Error>) -> Void)
@ -130,6 +131,7 @@ public protocol Transport {
func send(request: URLRequest, method: String, completion: @escaping (Result<Void, Error>) -> Void) func send(request: URLRequest, method: String, completion: @escaping (Result<Void, Error>) -> Void)
/// Sends URLRequest with a data payload and returns the HTTP headers and the data payload. /// Sends URLRequest with a data payload and returns the HTTP headers and the data payload.
@discardableResult
func send(request: URLRequest, method: String, payload: Data) async throws -> (HTTPURLResponse, Data?) func send(request: URLRequest, method: String, payload: Data) async throws -> (HTTPURLResponse, Data?)
func send(request: URLRequest, method: String, payload: Data, completion: @escaping (Result<(HTTPURLResponse, Data?), Error>) -> Void) func send(request: URLRequest, method: String, payload: Data, completion: @escaping (Result<(HTTPURLResponse, Data?), Error>) -> Void)