Skip to content

Commit

Permalink
Use text/html as the default content type for chunked transport
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo committed Aug 13, 2011
1 parent da4f770 commit 6daa4d0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/chat_websocket/config.ru
Expand Up @@ -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))

Expand Down
2 changes: 2 additions & 0 deletions lib/cramp/action.rb
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions test/controller/chunked_transport_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 6daa4d0

Please sign in to comment.