HeaderFieldsInterceptor

public class HeaderFieldsInterceptor : Interceptor

Implementation of a request interceptor which adds header fields to the request.

  • # Summary The initialiser for the HeaderFieldsRequestInterceptor

    Declaration

    Swift

    public init(headerFields: @autoclosure @escaping (() -> [String : String]))

    Parameters

    headerFields

    Either pass in a dictionary of header fields to be added or an autoclosure which then returns a dictionary of header fields to be added.

  • # Summary Intercepting the request by adding the given header fields.

    Declaration

    Swift

    public func intercept(_ request: URLRequest) -> URLRequest

    Parameters

    request

    The request to be intercepted.

    Return Value

    The intercepted request.