Browse files

Make sure to dup the headers coming from respond_with

  • Loading branch information...
1 parent 6841627 commit b3ee0fe19f7603b470f210289f779405822e7471 @lifo lifo committed Aug 27, 2011
Showing with 4 additions and 2 deletions.
  1. +1 −1 lib/cramp/abstract.rb
  2. +3 −1 lib/cramp/action.rb
View
2 lib/cramp/abstract.rb
@@ -44,7 +44,7 @@ def send_headers
end
def build_headers
- status, headers = respond_to?(:respond_with, true) ? respond_with : [200, {'Content-Type' => 'text/html'}]
+ status, headers = respond_to?(:respond_with, true) ? respond_with.dup : [200, {'Content-Type' => 'text/html'}]
headers['Connection'] ||= 'keep-alive'
[status, headers]
end
View
4 lib/cramp/action.rb
@@ -38,10 +38,12 @@ def build_headers
[status, headers.merge(self.default_sse_headers)]
when :chunked
status, headers = respond_to?(:respond_with, true) ? respond_with : [200, {}]
+
+ headers = headers.merge(self.default_chunked_headers)
headers['Content-Type'] ||= 'text/html'
headers['Cache-Control'] ||= 'no-cache'
- [status, headers.merge(self.default_chunked_headers)]
+ [status, headers]
else
super
end

0 comments on commit b3ee0fe

Please sign in to comment.