Disable HTTP caching application-wide (e.g. conditional GET)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Disable HTTP caching application-wide (e.g. conditional GET)

Jack Kinsella
I have a Rails 6 application that relies on public caching e.g. `expires_in 1.week, public: true`. These pages must undergo integration tests (Capybara/Headless Chrome), and some pages change state between test cases. In order to prevent sporadic, order-dependent test failures, I want to disable HTTP caching (i.e.  "Conditional GET") in my test suite.

My first intuition, based on the docs, was that setting `config.action_controller.perform_caching = false` would disable all caching, but this turned out to not be the case. Running `config.middleware.delete(Rack::ConditionalGet)` also didn't make a difference.

So:
1. Is there a clean way to do this?
2. If there _isn't_ a way, would there be any interest in a pull request implementing a configuration option, e.g. `config.action_controller.http_caching = false `? I'd be happy to contribute it, but only if you feel it's a potentially worthwhile addition.

Jack

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-core/cbd8a2f2-b67c-44ab-b009-a99c77abbb3a%40googlegroups.com.