Class: Mitt::App

Inherits:
Object
  • Object
show all
Defined in:
lib/mitt/app.rb

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ App

Returns a new instance of App.



3
4
5
# File 'lib/mitt/app.rb', line 3

def initialize(body)
  @body = body
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/mitt/app.rb', line 7

def call(env)
  request = Rack::Request.new(env)

  puts "--- #{request.request_method} #{request.path} ---"
  request_body = request.body.read
  puts request_body unless request_body.empty?

  ['200', {'Content-Type' => 'text/html'}, [@body]]
end