Sha256: 079264309a19eab2a886975701e706b31962057ce90834aa586029c7d1249ba2

Contents?: true

Size: 613 Bytes

Versions: 62

Compression:

Stored size: 613 Bytes

Contents

module Workarea
  # This class exists to disable all HTTP caching in the test envionrment.
  # There's no way to disable caching in headless Chrome so this ensures
  # reliability with running tests there.
  class StripHttpCachingMiddleware
    def initialize(app)
      @app = app
    end

    def call(env)
      status, headers, body = @app.call(env)

      unless Workarea.config.strip_http_caching_in_tests
        return [status, headers, body]
      end

      headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
      headers['Expires'] = '0'

      [status, headers, body]
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.5.26 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.4.45 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.5.25 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.5.23 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.4.44 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.5.22 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.4.43 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.5.21 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.4.42 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.5.20 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.4.41 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.5.19 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.4.40 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.5.18 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.4.39 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.5.17 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.4.38 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.5.16 app/middleware/workarea/strip_http_caching_middleware.rb
workarea-core-3.4.37 app/middleware/workarea/strip_http_caching_middleware.rb