Redirector

public struct Redirector

Redirector is a convenience RedirectHandler making it easy to follow, not follow, or modify a redirect.

  • Defines the behavior of the Redirector type.

    • follow: Follows the redirect as defined in the response.
    • doNotFollow: Does not follow the redirect defined in the response.
    • modify: Modifies the redirect request defined in the response.
    See more

    Declaration

    Swift

    public enum Behavior
  • Returns a Redirector with a follow Behavior.

    Declaration

    Swift

    public static let follow: Redirector
  • Returns a Redirector with a do not follow Behavior.

    Declaration

    Swift

    public static let doNotFollow: Redirector
  • The Behavior of the Redirector.

    Declaration

    Swift

    public let behavior: Behavior
  • Creates a Redirector instance from the Behavior.

    Declaration

    Swift

    public init(behavior: Behavior)

    Parameters

    behavior

    The Behavior.

  • Declaration

    Swift

    public func task(_ task: URLSessionTask,
              willBeRedirectedTo request: URLRequest,
              for response: HTTPURLResponse,
              completion: @escaping (URLRequest?) -> Void)