Rack CORS re config fix 4

James Peret 10 年 前
コミット
b8dcf8cd23
共有1 個のファイルを変更した4 個の追加1 個の削除を含む
  1. 4 1
      main.rb

+ 4 - 1
main.rb

@@ -37,9 +37,12 @@ end
37 37
 Whois::Server.define :tld, ".network", "whois.donuts.co"
38 38
 
39 39
 before do
40
-  response['Access-Control-Allow-Origin'] = '*'
40
+   content_type :json
41
+   headers  'Access-Control-Allow-Origin' => '*', 
42
+            'Access-Control-Allow-Methods' => ['OPTIONS', 'GET', 'POST']
41 43
 end
42 44
 
45
+
43 46
 helpers do
44 47
   def whois_structs_hash(whois)
45 48
     who_dat_is = whois.clone