gflare/middleware/cors

Types

pub type CorsConfig {
  CorsConfig(
    allow_origins: List(String),
    allow_methods: List(String),
    allow_headers: List(String),
    expose_headers: List(String),
    allow_credentials: Bool,
    max_age: Int,
  )
}

Constructors

  • CorsConfig(
      allow_origins: List(String),
      allow_methods: List(String),
      allow_headers: List(String),
      expose_headers: List(String),
      allow_credentials: Bool,
      max_age: Int,
    )

Values

pub fn custom(config: CorsConfig) -> router.Middleware
pub fn get_origin(
  request: request.HttpRequest,
) -> option.Option(String)
pub fn is_preflight(request: request.HttpRequest) -> Bool
pub fn middleware(config: CorsConfig) -> router.Middleware
pub fn permissive() -> router.Middleware
pub fn restrictive(origins: List(String)) -> router.Middleware
pub fn set_cors_headers(
  resp: response.Response,
  origin: String,
  config: CorsConfig,
) -> response.Response
Search Document