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.
Declaration
Swift
public enum Behavior
-
Returns a
Redirector
with a followBehavior
.Declaration
Swift
public static let follow: Redirector
-
Returns a
Redirector
with a do not followBehavior
.Declaration
Swift
public static let doNotFollow: Redirector
-
Declaration
Swift
public func task(_ task: URLSessionTask, willBeRedirectedTo request: URLRequest, for response: HTTPURLResponse, completion: @escaping (URLRequest?) -> Void)