ImageDownloadRedirectHandler

public protocol ImageDownloadRedirectHandler

Represents and wraps a method for modifying request during an image download request redirection.

  • The ImageDownloadRedirectHandler contained will be used to change the request before redirection. This is the posibility you can modify the image download request during redirection. You can modify the request for some customizing purpose, such as adding auth token to the header, do basic HTTP auth or something like url mapping.

    Usually, you pass an ImageDownloadRedirectHandler as the associated value of KingfisherOptionsInfoItem.redirectHandler and use it as the options parameter in related methods.

    If you do nothing with the input request and return it as is, a downloading process will redirect with it.

    Declaration

    Swift

    func handleHTTPRedirection(for task: SessionDataTask, response: HTTPURLResponse, newRequest: URLRequest, completionHandler: @escaping (URLRequest?) -> Void)

    Parameters

    task

    The current SessionDataTask which triggers this redirect.

    response

    The response received during redirection.

    newRequest

    The request for redirection which can be modified.

    completionHandler

    A closure for being called with modified request.