Skip to content

CORSMiddleware_AllowOriginSetting

Josh Wright edited this page Jan 14, 2021 · 3 revisions

CORSMiddleware.AllowOriginSetting

Option for the allow origin header in responses for CORS requests.

public enum AllowOriginSetting
  • none: Disallows any origin.

  • originBased: Uses value of the origin header in the request.

  • all: Uses wildcard to allow any origin.

  • any: A list of allowable origins.

  • custom: Uses custom string provided as an associated value.

Enumeration Cases

none

Disallow any origin.

case none

originBased

Uses value of the origin header in the request.

case originBased

all

Uses wildcard to allow any origin.

case all

any

A list of allowable origins.

case any(: [String])

custom

Uses custom string provided as an associated value.

case custom(: String)

Methods

header(forRequest:)

Creates the header string depending on the case of self.

public func header(forRequest req: Request) -> String

Parameters

  • request: Request for which the allow origin header should be created.

Returns

Header string to be used in response for allowed origin.

Alchemy
Types
Protocols
Global Typealiases
Global Variables
Global Functions
Fusion
Types
Protocols
Papyrus
Types
Protocols
Clone this wiki locally