These are chat archives for opal/opal

12th
Apr 2017
VinceG3
@VinceG3
Apr 12 2017 01:36 UTC
Hey, I'm trying to get HTTP.postcalls working, it wants to send preflight OPTIONS calls, and Sinatra isn't set up to handle them. Has anyone figured out how to get opal-jquery to not send those?
VinceG3
@VinceG3
Apr 12 2017 19:28 UTC
easiest solution turned out to be doing this in Sinatra:
  options '*' do
    response['Access-Control-Allow-Origin'] = '*'
    response['Access-Control-Allow-Methods'] = 'POST'
    response['Access-Control-Allow-Headers'] = 'Content-Type'
    ''
  end
Jamie Gaskins
@jgaskins
Apr 12 2017 23:37 UTC
@VinceG3 Check out the rack-cors gem if you want to customize your CORS preflights.
We use it at work. Its DSL is pretty great. It works with any Rack app.