Skip to content

Commit

Permalink
Make sure to dup the headers coming from respond_with
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo committed Aug 27, 2011
1 parent 6841627 commit b3ee0fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/cramp/abstract.rb
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/cramp/action.rb
Expand Up @@ -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
Expand Down

0 comments on commit b3ee0fe

Please sign in to comment.