Class: ServerHere::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/server_here/core.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/server_here/core.rb', line 4

def call env
  req = Rack::Request.new env
  path = File.join('.', req.path_info)
  
  file = FileWrapper.new path
  
  header = {
    'Content-Type' => file.content_type,
    'Last-Modified' => file.last_mod
  }
  
  [200, header, file.to_body]
end