Skip to content

Commit

Permalink
Removing a bug from lib/embed_action.rb file, we were getting the def…
Browse files Browse the repository at this point in the history
…ault headers from ActionController::Response, even in the case when the Response constant was not defined inside

the ActionController module, changed that to response.class:DEFAULT_HEADERS, this works if and only if all
the responses classes respond to the DEFAULT_HEADERS constant.

Signed-off-by: Sebastian Delmont <sd@notso.net>
  • Loading branch information
roman authored and sd committed Jun 15, 2009
1 parent adaba31 commit 73d4c57
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/embedded_actions/embed_action.rb
Expand Up @@ -109,11 +109,12 @@ def embedded_response(options, reuse_response)
else
if ActionController.const_defined? "Response"
new_response = ActionController::Response.new
ActionController::Response::DEFAULT_HEADERS.each {|k, v| new_response.headers[k] = v}
else
new_response = response.dup
new_response.headers.clear
response.class::DEFAULT_HEADERS.each { |k, v| new_response.headers[k] = v }
end
ActionController::Response::DEFAULT_HEADERS.each {|k, v| new_response.headers[k] = v}

# Using a content-encoding header prevents output compression filters from messing with this response
new_response.headers['Content-Encoding'] = "identity"
Expand Down

0 comments on commit 73d4c57

Please sign in to comment.