Contents

additionalHeaderFields

Additional headers to send when loading the initial URL.

Declaration

var additionalHeaderFields: [String : String]? { get }

Discussion

Apply these headers only to the initial page, and don’t overwrite any headers that the browser usually sends.

This example shows the call to the begin(_:) delegate method when a web browser receives a request from an app. This implementation iterates over the additional header fields from the app’s request and adds them to its own request.

func begin(_ request: ASWebAuthenticationSessionRequest!) {
    self.request = request

    let urlRequest = URLRequest(url: request.url)
    // Use the new fields on the URL request.
    for (header, value) in request.additionalHeaderFields {
        urlRequest.addValue(value, forHTTPHeaderField: header)
    }

    // Load the URL request.
}

See Also

Interpreting a request