xentek / hyperdrive

hypermedia state machine
https://rubygems.org/gems/hyperdrive
MIT License
5 stars 0 forks source link

CORS implementation #2

Closed jpark3000 closed 10 years ago

jpark3000 commented 10 years ago

Implements CORS middleware/DSL.

On Hyperdrive::DSL::Main CORS options are passed in thorough #cors as a hash. Keys are sanitized and set to a hash instance variable @config[:cors] @config provides one place for all configurations to live on the Hyperdrive::DSL::Main level.

On Hyperdrive::Middleware::CORS default CORS options are provided. Default values were based on https://github.com/britg/sinatra-cross_origin. #format_options takes in options from the DSL level and formats keys and values to be valid CORS headers.