head.rb 257 B

12345678910111213141516171819
  1. module Rack
  2. class Head
  3. def initialize(app)
  4. @app = app
  5. end
  6. def call(env)
  7. status, headers, body = @app.call(env)
  8. if env["REQUEST_METHOD"] == "HEAD"
  9. [status, headers, []]
  10. else
  11. [status, headers, body]
  12. end
  13. end
  14. end
  15. end