didSendRequestPart(task:_:)
Called when a part of the request body is sent. Could be called zero or more times.
func didSendRequestPart(task: HTTPClient.Task<Response>, _ part: IOData)
Called when a part of the request body is sent. Could be called zero or more times.
func didSendRequestPart(task: HTTPClient.Task<Response>, _ part: IOData)
s15AsyncHTTPClient0B16ResponseDelegateP18didSendRequestPart4task_yAA0B0C4TaskCy_0C0QzG_7NIOCore6IODataOtF
What are these?4QXAP
import AsyncHTTPClient
This package provides simple HTTP Client library built on top of SwiftNIO.
protocol HTTPClientResponseDelegate : AnyObject
HTTPClientResponseDelegate
allows an implementation to receive notifications about request processing and to control how response parts are processed.
class HTTPClient
HTTPClient class provides API for request execution.
final class Task<Response>
Response execution context.
associatedtype Response
enum IOData
IOData
unifies standard SwiftNIO types that are raw bytes of data; currently ByteBuffer
and FileRegion
.
func didFinishRequest(task: HTTPClient.Task<Response>) throws -> Response
Called when the complete HTTP request is finished. You must return an instance of your Response
associated type. Will be called once, except if an error occurred.
func didReceiveBodyPart(task: HTTPClient.Task<Response>, _ buffer: ByteBuffer) -> EventLoopFuture<Void>
Called when part of a response body is received. Could be called zero or more times. You must return an EventLoopFuture<Void>
that you complete when you have finished processing the body part. You can create an already succeeded future by calling task.eventLoop.makeSucceededFuture(())
.
func didReceiveError(task: HTTPClient.Task<Response>, _ error: Error)
Called when error was thrown during request execution. Will be called zero or one time only. Request processing will be stopped after that.
func didReceiveHead(task: HTTPClient.Task<Response>, _ head: HTTPResponseHead) -> EventLoopFuture<Void>
Called when response head is received. Will be called once. You must return an EventLoopFuture<Void>
that you complete when you have finished processing the body part. You can create an already succeeded future by calling task.eventLoop.makeSucceededFuture(())
.
func didSendRequest(task: HTTPClient.Task<Response>)
Called when the request is fully sent. Will be called once.
func didSendRequestHead(task: HTTPClient.Task<Response>, _ head: HTTPRequestHead)
Called when the request head is sent. Will be called once.
func didSendRequestPart(task: HTTPClient.Task<Response>, _ part: IOData)
Default implementation of didSendRequestPart(task:_:)
.