Module: HttpStub::Server::Application::CrossOriginSupport::Helpers

Defined in:
lib/http_stub/server/application/cross_origin_support.rb

Instance Method Summary collapse

Instance Method Details

#add_headers_if_necessaryObject


9
10
11
12
13
14
15
16
17
# File 'lib/http_stub/server/application/cross_origin_support.rb', line 9

def add_headers_if_necessary
  if settings.cross_origin_support?
    response.headers.merge!(
      "Access-Control-Allow-Origin"  => "*",
      "Access-Control-Allow-Methods" => determine_allowed_methods,
      "Access-Control-Allow-Headers" => determine_allowed_headers
    )
  end
end

#handle_options_if_necessaryObject


19
20
21
22
# File 'lib/http_stub/server/application/cross_origin_support.rb', line 19

def handle_options_if_necessary
  pass unless settings.cross_origin_support?
  halt 200
end