Module: Rack::App::InstanceMethods::ServeFile

Included in:
Rack::App::InstanceMethods
Defined in:
lib/rack/app/instance_methods/serve_file.rb

Instance Method Summary collapse

Instance Method Details

#serve_file(file_path) ⇒ Object

[View source]

3
4
5
6
7
8
9
# File 'lib/rack/app/instance_methods/serve_file.rb', line 3

def serve_file(file_path)
  rack_resp = Rack::App::FileServer.serve_file(request.env, file_path)
  response.status = rack_resp[0]
  response.headers.merge!(rack_resp[1])
  response.body = rack_resp[2]
  finish!
end