class

Amber::Pipe::CORS

Inherits Amber::Pipe::Base < HTTP::Handler < Reference < Object

Constants

ALLOW_HEADERS = ["Accept", "Content-Type"] of ::String
ALLOW_METHODS = ["POST", "PUT", "PATCH", "DELETE"] of ::String
FORBIDDEN = "Forbidden for invalid origins, methods or headers"

Constructors

new(origins : OriginType = ["*", %r()], methods : Array(String) = ALLOW_METHODS, headers : Array(String) = ALLOW_HEADERS, credentials : Bool = false, max_age : Int32 | Nil = 0, expose_headers : Array(String) | Nil = nil, vary : String | Nil = nil)
Source

Instance methods

call(context : HTTP::Server::Context)

Execution of this handler.

Source
credentials
Source
credentials=(credentials : Bool)
Source
forbidden(context)
Source
headers
Source
headers=(headers : Array(String))
Source
max_age
Source
max_age=(max_age : Int32 | Nil)
Source
methods
Source
methods=(methods : Array(String))
Source
origins
Source
origins=(origins : Array(Regex | String))
Source

Nested types