Do Content-negotiation for Cached Content
The action_cache plugin broke our content-negotiation. Fixed.
This commit is contained in:
parent
5db9b7d3ea
commit
dc629f5c07
|
@ -144,6 +144,8 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
public
|
||||||
|
|
||||||
def set_content_type_header
|
def set_content_type_header
|
||||||
if %w(atom_with_content atom_with_headlines).include?(action_name)
|
if %w(atom_with_content atom_with_headlines).include?(action_name)
|
||||||
response.headers['Content-Type'] = 'application/atom+xml; charset=UTF-8'
|
response.headers['Content-Type'] = 'application/atom+xml; charset=UTF-8'
|
||||||
|
@ -158,6 +160,8 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
def set_robots_metatag
|
def set_robots_metatag
|
||||||
if controller_name == 'wiki' and %w(show published).include? action_name
|
if controller_name == 'wiki' and %w(show published).include? action_name
|
||||||
@robots_metatag_value = 'index,follow'
|
@robots_metatag_value = 'index,follow'
|
||||||
|
|
|
@ -141,6 +141,7 @@ module ActionController
|
||||||
def send_cached_response(cache_entry, controller)
|
def send_cached_response(cache_entry, controller)
|
||||||
controller.logger.info "Send #{body_name(controller)} by response.body"
|
controller.logger.info "Send #{body_name(controller)} by response.body"
|
||||||
controller.response.headers = cache_entry.headers
|
controller.response.headers = cache_entry.headers
|
||||||
|
controller.set_content_type_header
|
||||||
controller.response.body = fragment_body(controller)
|
controller.response.body = fragment_body(controller)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue