lib/faye/adapters/rack_adapter.rb in faye-0.8.3 vs lib/faye/adapters/rack_adapter.rb in faye-0.8.4
- old
+ new
@@ -9,13 +9,13 @@
ASYNC_RESPONSE = [-1, {}, []].freeze
DEFAULT_ENDPOINT = '/bayeux'
SCRIPT_PATH = 'faye-browser-min.js'
- TYPE_JSON = {'Content-Type' => 'application/json'}
- TYPE_SCRIPT = {'Content-Type' => 'text/javascript'}
- TYPE_TEXT = {'Content-Type' => 'text/plain'}
+ TYPE_JSON = {'Content-Type' => 'application/json; charset=utf-8'}
+ TYPE_SCRIPT = {'Content-Type' => 'text/javascript; charset=utf-8'}
+ TYPE_TEXT = {'Content-Type' => 'text/plain; charset=utf-8'}
# This header is passed by Rack::Proxy during testing. Rack::Proxy seems to
# set content-length for you, and setting it in here really slows the tests
# down. Better suggestions welcome.
HTTP_X_NO_CONTENT_LENGTH = 'HTTP_X_NO_CONTENT_LENGTH'
@@ -108,11 +108,11 @@
callback = request.env['async.callback']
@server.flush_connection(message) if request.get?
headers['Access-Control-Allow-Origin'] = origin if origin
- headers['Cache-Control'] = 'no-cache, no-store' if request.get?
+ headers['Cache-Control'] = 'no-cache, no-store'
@server.process(message, false) do |replies|
response = Faye.to_json(replies)
response = "#{ jsonp }(#{ response });" if request.get?
headers['Content-Length'] = response.bytesize.to_s unless request.env[HTTP_X_NO_CONTENT_LENGTH]
@@ -202,10 +202,10 @@
headers = {
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Credentials' => 'false',
'Access-Control-Max-Age' => '86400',
'Access-Control-Allow-Methods' => 'POST, GET, PUT, DELETE, OPTIONS',
- 'Access-Control-Allow-Headers' => 'Accept, Content-Type, X-Requested-With'
+ 'Access-Control-Allow-Headers' => 'Accept, Content-Type, Pragma, X-Requested-With'
}
[200, headers, ['']]
end
end