lib/roda/plugins/sinatra_helpers.rb in roda-2.14.0 vs lib/roda/plugins/sinatra_helpers.rb in roda-2.15.0
- old
+ new
@@ -337,12 +337,18 @@
if lm = opts[:last_modified]
last_modified(lm)
end
- file = ::Rack::File.new nil
- file.path = path
- s, h, b = file.serving(@env)
+ file = ::Rack::File.new nil
+ s, h, b = if Rack.release > '2'
+ # :nocov:
+ file.serving(self, path)
+ # :nocov:
+ else
+ file.path = path
+ file.serving(@env)
+ end
res.status = opts[:status] || s
headers.delete(CONTENT_LENGTH)
headers.replace(h.merge!(headers))
res.body = b