Response
HTTPHandler.swift:649associatedtype Response
associatedtype Response
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.
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)
Called when a part of the request body is sent. Could be called zero or more times.