ResponsePipelineRedirector
public protocol ResponsePipelineRedirector : AnyObject
Represents a redirection stage of a series of response pipelines. Use redirectors to additionally
perform data processing by invoking closure with a proper
ResponsePipelineRedirectorAction enumeration member.
-
Whether this redirector should be applied to execute and handle a received HTTP response.
Declaration
Swift
func shouldApply<T>(request: T, data: Data, response: HTTPURLResponse) -> Bool where T : RequestParameters
requestThe original
Request.dataThe received data contained in the HTTP response.
responseThe received HTTP response to the request.
-
Performs the redirect action for current redirector. Define how to process the received response and data. When the process is finished, call
closurewith the required action to make the response pipeline continue.Declaration
Swift
func redirect<T: Request>( request: T, data: Data, response: HTTPURLResponse, done closure: @escaping (ResponsePipelineRedirectorAction) throws -> Void) throwsParameters
requestThe original
Request.dataThe received data contained in the HTTP response.
responseThe received HTTP response to the request.
closureA block to be called when you have finished processing the received response and data. The block takes a single parameter, which must be one of the member in the
ResponsePipelineRedirectorActionenumeration.
View on GitHub
ResponsePipelineRedirector Protocol Reference