Required Instance Methodasync-http-client 1.23.0AsyncHTTPClient
didFinishRequest(task:)
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 didFinishRequest(task: HTTPClient.Task<Response>) throws -> Response
Parameters
- task
Current request context.
Returns
Result of processing.
This function will not be called until all futures returned by didReceiveHead(task:_:)
and didReceiveBodyPart(task:_:)
have completed. Once called, no further calls will be made to didReceiveHead(task:_:)
, didReceiveBodyPart(task:_:)
, or didReceiveError(task:_:)
.
Other requirements
Type members
Instance members
func didReceiveBodyPart(task: HTTPClient.Task<Response>, 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 callingtask.eventLoop.makeSucceededFuture(())
.func didReceiveError(task: HTTPClient.Task<Response>, 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>, 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 callingtask.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>, HTTPRequestHead
) Called when the request head is sent. Will be called once.
func didSendRequestPart(task: HTTPClient.Task<Response>, IOData
) Called when a part of the request body is sent. Could be called zero or more times.