Classes
The following classes are available globally.
-
Handles a streaming download to a given file path, allowing headers and progress to be reported.
See moreDeclaration
Swift
public final class FileDownloadDelegate : HTTPClientResponseDelegate
-
HTTPClient class provides API for request execution.
Example:
let client = HTTPClient(eventLoopGroupProvider: .createNew) client.get(url: "https://swift.org", deadline: .now() + .seconds(1)).whenComplete { result in switch result { case .failure(let error): // process error case .success(let response): if let response.status == .ok { // handle response } else { // handle remote error } } }
It is important to close the client instance, for example in a defer statement, after use to cleanly shutdown the underlying NIO
EventLoopGroup
:
See moretry client.syncShutdown()
Declaration
Swift
public class HTTPClient
-
Undocumented
See moreDeclaration
Swift
public class ResponseAccumulator : HTTPClientResponseDelegate
-
Undocumented
See moreDeclaration
Swift
public final class HTTPClientCopyingDelegate : HTTPClientResponseDelegate