lib/mini_profiler/actions.rb in rack-mini-profiler-3.3.0 vs lib/mini_profiler/actions.rb in rack-mini-profiler-3.3.1
- old
+ new
@@ -53,10 +53,15 @@
def serve_file(env, file_name:)
resources_env = env.dup
resources_env['PATH_INFO'] = file_name
- rack_file = Rack::File.new(resources_root, 'Cache-Control' => "max-age=#{cache_control_value}")
+ if Gem::Version.new(Rack.release) >= Gem::Version.new("2.1.0")
+ rack_file = Rack::Files.new(resources_root, 'Cache-Control' => "max-age=#{cache_control_value}")
+ else
+ rack_file = Rack::File.new(resources_root, 'Cache-Control' => "max-age=#{cache_control_value}")
+ end
+
rack_file.call(resources_env)
end
def serve_results(env)
request = Rack::Request.new(env)