-
Notifications
You must be signed in to change notification settings - Fork 14
CORSMiddleware_Configuration
Configuration used for populating headers in response for CORS requests.
public struct Configuration
Instantiate a CORSConfiguration struct that can be used to
create a CORSConfiguration
middleware for adding support
for CORS in your responses.
public init(allowedOrigin: AllowOriginSetting, allowedMethods: [HTTPMethod], allowedHeaders: [String], allowCredentials: Bool = false, cacheExpiration: Int? = 600, exposedHeaders: [String]? = nil)
- allowedOrigin: Setting that controls which origin values are allowed.
- allowedMethods: Methods that are allowed for a CORS request response.
- allowedHeaders: Headers that are allowed in a response for CORS request.
- allowCredentials: If cookies and other credentials will be sent in the response.
- cacheExpiration: Optionally sets expiration of the cached pre-flight request in seconds.
- exposedHeaders: Headers exposed in the response of pre-flight request.
Setting that controls which origin values are allowed.
let allowedOrigin: AllowOriginSetting
Header string containing methods that are allowed for a CORS request response.
let allowedMethods: String
Header string containing headers that are allowed in a response for CORS request.
let allowedHeaders: String
If set to yes, cookies and other credentials will be sent in the response for CORS request.
let allowCredentials: Bool
Optionally sets expiration of the cached pre-flight request. Value is in seconds.
let cacheExpiration: Int?
Headers exposed in the response of pre-flight request.
let exposedHeaders: String?
Default CORS configuration.
public static func `default`() -> Configuration
-
Allow Origin: Based on request's
Origin
value. -
Allow Methods:
GET
,POST
,PUT
,OPTIONS
,DELETE
,PATCH
-
Allow Headers:
Accept
,Authorization
,Content-Type
,Origin
,X-Requested-With
Generated at 2021-01-13T22:24:59-0800 using swift-doc 1.0.0-beta.5.
Alchemy
Types
- AlterTableBuilder
- BCryptDigest
- BasicAuthMiddleware
- BcryptError
- BelongsToRelationship
- CORSMiddleware
- CORSMiddleware.AllowOriginSetting
- CORSMiddleware.Configuration
- ColumnType
- CreateColumn
- CreateColumnBuilder
- CreateIndex
- CreateTableBuilder
- DatabaseConfig
- DatabaseError
- DatabaseField
- DatabaseKeyMappingStrategy
- DatabaseValue
- DayUnit
- Env
- FrequencyTyped
- Grammar
- HTTPAuth
- HTTPAuth.Basic
- HTTPAuth.Bearer
- HTTPBody
- HTTPError
- HasManyRelationship
- HasOneRelationship
- HasRelationship
- HourUnit
- JoinClause
- JoinType
- Launch
- Log
- MIMEType
- MinuteUnit
- ModelQuery
- MySQLDatabase
- Operator
- OrderClause
- OrderClause.Sort
- OrderedDictionary
- PapyrusClientError
- PathParameter
- PathParameter.DecodingError
- PostgresDatabase
- Query
- Request
- Response
- Router
- RuneError
- SQL
- SQLJSON
- Scheduler
- Schema
- SecondUnit
- Services
- Socket
- StaticFileMiddleware
- StringLength
- Thread
- TokenAuthMiddleware
- WeekUnit
- Weekday
- WhereBoolean
- WhereColumn
- WhereIn
- WhereIn.InType
- WhereNested
- WhereRaw
- WhereValue