class Amber::Pipe::CORS

Defined in:

amber/pipes/cors.cr

Constant Summary

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

Constructors

Instance Method Summary

Instance methods inherited from class Amber::Pipe::Base

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

Constructor Detail

def self.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) #

[View source]

Instance Method Detail

def call(context : HTTP::Server::Context) #
Description copied from class Amber::Pipe::Base

Execution of this handler.


[View source]
def credentials : Bool #

[View source]
def credentials=(credentials : Bool) #

[View source]
def forbidden(context) #

[View source]
def headers : Array(String) #

[View source]
def headers=(headers : Array(String)) #

[View source]
def max_age : Int32? #

[View source]
def max_age=(max_age : Int32 | Nil) #

[View source]
def methods : Array(String) #

[View source]
def methods=(methods : Array(String)) #

[View source]
def origins : Array(Regex | String) #

[View source]
def origins=(origins : Array(Regex | String)) #

[View source]