Class: Rack::Head

Inherits:
Object show all
Defined in:
lib/gems/rack-0.9.1/lib/rack/head.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Head

Returns a new instance of Head.



4
5
6
# File 'lib/gems/rack-0.9.1/lib/rack/head.rb', line 4

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/gems/rack-0.9.1/lib/rack/head.rb', line 8

def call(env)
  status, headers, body = @app.call(env)

  if env["REQUEST_METHOD"] == "HEAD"
    [status, headers, []]
  else
    [status, headers, body]
  end
end