Class: ActionDispatch::Head
- Inherits:
-
Object
- Object
- ActionDispatch::Head
- Defined in:
- lib/action_dispatch/middleware/head.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Head
constructor
A new instance of Head.
Constructor Details
#initialize(app) ⇒ Head
Returns a new instance of Head.
3 4 5 |
# File 'lib/action_dispatch/middleware/head.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/action_dispatch/middleware/head.rb', line 7 def call(env) if env["REQUEST_METHOD"] == "HEAD" env["REQUEST_METHOD"] = "GET" env["rack.methodoverride.original_method"] = "HEAD" status, headers, body = @app.call(env) [status, headers, []] else @app.call(env) end end |