Class: Rack::Head

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/head.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Head

Returns a new instance of Head.



4
5
6
# File '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/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