Permalink
Browse files

Fix CORS and add proper content-type headers

  • Loading branch information...
1 parent b9237ea commit 7368a236f17806f23d8e80780d4434aa4fa55b0f @Kimtaro committed Nov 6, 2011
Showing with 6 additions and 1 deletion.
  1. +1 −1 Gemfile
  2. +5 −0 sinatra/server.rb
View
@@ -1,8 +1,8 @@
source "http://rubygems.org"
gem "json"
-gem "rack-cors", :require => "rack/cors"
group :server do
gem "sinatra"
+ gem "rack-cors"
end
View
@@ -1,6 +1,8 @@
require 'rubygems'
+require 'bundler/setup'
require 'sinatra'
require 'json'
+require 'rack/cors'
require File.expand_path(File.dirname(__FILE__) + "/../lib/ve")
@@ -35,6 +37,9 @@ def run
if params[:callback]
json = "#{params[:callback]}(#{json})"
+ content_type 'application/javascript', :charset => 'utf-8'
+ else
+ content_type 'application/json', :charset => 'utf-8'
end
json

0 comments on commit 7368a23

Please sign in to comment.