Permalink
Browse files

Use text/html as the default content type for chunked transport

  • Loading branch information...
1 parent da4f770 commit 6daa4d023f59d5c911a6974bf9896d2a3c22c585 @lifo committed Aug 13, 2011
Showing with 5 additions and 0 deletions.
  1. +2 −0 examples/chat_websocket/config.ru
  2. +2 −0 lib/cramp/action.rb
  3. +1 −0 test/controller/chunked_transport_test.rb
@@ -16,6 +16,8 @@ end
module ChatRamp
class HomeAction < Cramp::Action
+ self.transport = :chunked
+
template_path = File.join(File.dirname(__FILE__), 'views/index.erb')
@@template = Erubis::Eruby.new(File.read(template_path))
View
@@ -38,6 +38,8 @@ def build_headers
[status, headers.merge(self.default_sse_headers)]
when :chunked
status, headers = respond_to?(:respond_with, true) ? respond_with : [200, {}]
+ headers['Content-Type'] ||= 'text/html'
+
[status, headers.merge(self.default_chunked_headers)]
else
super
@@ -21,6 +21,7 @@ def test_headers
get '/' do |status, headers, body|
assert_equal 200, status
assert_equal "chunked", headers["Transfer-Encoding"]
+ assert_equal "text/html", headers["Content-Type"]
assert_kind_of Cramp::Body, body
EM.stop

0 comments on commit 6daa4d0

Please sign in to comment.