-
Initialize an instance of
CORS.Declaration
Swift
public init(options: Options)Parameters
optionsThe options to configure CORS.
-
Handle an incoming request by setting the CORS headers in the response.
Throws
Any
ErrorType. If an error is thrown, processing of the request is stopped, the error handlers, if any are defined, will be invoked, and the user will get a response with a status code of 500.Declaration
Swift
public func handle(request: RouterRequest, response: RouterResponse, next: @escaping () -> Void) throwsParameters
requestThe
RouterRequestobject used to get information about the request.responseThe
RouterResponseobject used to respond to the request.nextThe closure to invoke to enable the Router to check for other handlers or middleware to work with this request.
View on GitHub
CORS Class Reference