Skip to content

struct Athena::Framework::Listeners::CORS
inherits Struct #

Supports Cross-Origin Resource Sharing (CORS) requests.

Handles CORS preflight OPTIONS requests as well as adding CORS headers to each response. See ATH::Config::CORS for information on configuring the listener.

Tip

Set your Log::Severity to TRACE to help debug the listener.

Included modules

Athena::EventDispatcher::EventListenerInterface

Constants#

SAFELISTED_HEADERS = ["accept", "accept-language", "content-language", "content-type", "origin"]#

SAFELISTED_METHODS = ["GET", "POST", "HEAD"]#

Constructors#

.new(config : ATH::Config::CORS | Nil)#

View source

Methods#

#on_request(event : ATH::Events::Request) : Nil#

View source

#on_response(event : ATH::Events::Response) : Nil#

View source