This project is archived and is in readonly mode.
Rails respond_to processes XML but caches HTML
-
Neeraj Singh
- State changed from new to open
- Assigned user set to Neeraj Singh
- Importance changed from to Low
-
Neeraj Singh
If the request has an extension like .xml, .js or .html then the cached page will have the extension that was supplied from the request.
If the request does not have extension then a default .html extension is used as per https://github.com/rails/rails/blob/master/actionpack/lib/action_co...
The HTTP_ACCEPT header value is totally being ignored.
I will try to find more information about the above mentioned code from rails core team.
-
Stephen
Yea I had a browse of that code in pages.rb.
It's almost as if the pages.rb code needs to know the value in the respond_to method to correctly work out the extension it should use.
I don't know enough about the internals to know if it the relevant objects are accessible inside pages.rb I'm afraid.
-
Neeraj Singh
I have a fix that is working. Trying to write a test. Will update when fix is ready.
-
Neeraj Singh
- Assigned user changed from Neeraj Singh to José Valim
Fix along with test is here.
https://github.com/neerajdotname/rails/commit/a5054cc5e2a98685d0d6f...
-
Neeraj Singh
For reference adding that ticket #1244 caches_page does not respect Accept header is about the same issue.
-
Repository
- State changed from open to resolved
(from [0027b654215cd6310d0d17daeaafec8ebbfb38d4]) Ensure that while caching a page rails takes into account the resolved mime type for the request
[#6110 Rails respond_to processes XML but caches HTML state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
https://github.com/rails/rails/commit/0027b654215cd6310d0d17daeaafe...