Options
public struct Options
The options for configuration of CORS
.
See CORS manual for more details.
-
A configuration of the Access-Control-Allow-Origin response header.
Declaration
Swift
public var allowedOrigin: AllowedOrigins
-
An indication as to whether to set the Access-Control-Allow-Credentials header.
Declaration
Swift
public var credentials: Bool
-
An array of methods to be passed in the Access-Control-Allow-Methods header.
Declaration
Swift
public var methods: [String]
-
An array of allowed headers to configure the Access-Control-Allow-Headers header. If not specified, the headers specified in the request’s Access-Control-Request-Headers header are passed.
Declaration
Swift
public var allowedHeaders: [String]?
-
An integer to set the Access-Control-Allow-Max-Age header. If not set, the header is omitted.
Declaration
Swift
public var maxAge: Int?
-
An array of exposed headers to configure the Access-Control-Expose-Headers header. If not set, the header is omitted.
Declaration
Swift
public var exposedHeaders: [String]?
-
A boolean that defines whether or not to pass the CORS preflight response to the next handler.
Declaration
Swift
public var preflightContinue: Bool
-
Initialize an instance of
Options
.Declaration
Swift
public init(allowedOrigin: AllowedOrigins = .all, credentials: Bool = false, methods: [String] = ["GET","HEAD","PUT","PATCH","POST","DELETE"], allowedHeaders: [String]? = nil, maxAge: Int? = nil, exposedHeaders: [String]? = nil, preflightContinue: Bool = false)
Parameters
allowedOrigin
A configuration of the Access-Control-Allow-Origin response header.
credentials
An indication as to whether to set the Access-Control-Allow-Credentials header.
methods
An array of methods to be passed in the Access-Control-Allow-Methods header.
allowedHeaders
An array of allowed headers to configure the Access-Control-Allow-Headers header.
maxAge
An integer to set the Access-Control-Allow-Max-Age header.
exposedHeaders
An array of exposed headers to configure the Access-Control-Expose-Headers header.
preflightContinue
A boolean that defines whether to pass the CORS preflight response to the next handler.