Does Sinatra support the OPTIONS HTTP verb? Something like:
options '/' do
response.headers["Access-Control-Allow-Origin"] = "*"
response.headers["Access-Control-Allow-Methods"] = "POST"
halt 200
end
Does Sinatra support the OPTIONS HTTP verb? Something like:
options '/' do
response.headers["Access-Control-Allow-Origin"] = "*"
response.headers["Access-Control-Allow-Methods"] = "POST"
halt 200
end
After a bit of hacking I managed to get it working using:
Edit:
After some more looking around on this issue, I realized that a PULL request is up on GitHub for the addition of the
OPTIONS
verb (https://github.com/sinatra/sinatra/pull/129). I took the solution and hacked it in using the following snippet:Now I can simply use:
Edit:
The pull request should be merged. No more need for the hack.
No it does not. If you look at the code on GitHub you can see where the HTTP verbs are defined, and
options
is not one of them.Yes, already does it Sinatra Routes documentation
the answer is, simply, yes! (look under Routes in the read me http://www.sinatrarb.com/intro.html)