Add OPTIONS resource, allow Content-Type header

This commit is contained in:
Basti 2012-02-29 18:30:47 +01:00
parent 30cd0536b2
commit 46c230d0d7

View File

@ -30,7 +30,7 @@ class LiquorCabinet < Sinatra::Base
before "/:user/:category/:key" do
headers 'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'GET, PUT, DELETE',
'Access-Control-Allow-Headers' => 'Authorization'
'Access-Control-Allow-Headers' => 'Authorization, Content-Type'
@user, @category, @key = params[:user], params[:category], params[:key]
token = env["HTTP_AUTHORIZATION"] ? env["HTTP_AUTHORIZATION"].split(" ")[1] : ""
@ -55,4 +55,8 @@ class LiquorCabinet < Sinatra::Base
delete_data(@user, @category, @key)
end
options "/:user/:category/:key" do
halt 200
end
end