CorsSettings

data class CorsSettings(allowedOrigin: Regex, allowedMethods: Set<Method>, allowedHeaders: Set<String>, exposedHeaders: Set<String>, supportCredentials: Boolean, preFlightStatus: Int, preFlightMaxAge: Long)

HTTP CORS setting. It holds info for CORS.

Constructors

Link copied to clipboard
fun CorsSettings(allowedOrigin: String = "*", allowedMethods: Set<Method> = ALL, allowedHeaders: Set<String> = emptySet(), exposedHeaders: Set<String> = emptySet(), supportCredentials: Boolean = true, preFlightStatus: Int = 204, preFlightMaxAge: Long = 0)
Link copied to clipboard
fun CorsSettings(allowedOrigin: Regex, allowedMethods: Set<Method> = ALL, allowedHeaders: Set<String> = emptySet(), exposedHeaders: Set<String> = emptySet(), supportCredentials: Boolean = true, preFlightStatus: Int = 204, preFlightMaxAge: Long = 0)

Functions

Link copied to clipboard
fun accessControlAllowOrigin(origin: String): String

Provides the origin based on access control check for CORS.

Link copied to clipboard
fun allowOrigin(origin: String): Boolean

Checks whether given origin is allowed.

Properties

Link copied to clipboard
val allowedHeaders: Set<String>
Link copied to clipboard
val allowedMethods: Set<Method>
Link copied to clipboard
val allowedOrigin: Regex
Link copied to clipboard
val exposedHeaders: Set<String>
Link copied to clipboard
val preFlightMaxAge: Long = 0
Link copied to clipboard
val preFlightStatus: Int = 204
Link copied to clipboard
val supportCredentials: Boolean = true