Sha256: ec8002dc8048f0f8e13b265ca9986869d8236ace9ae3771517afdc43b2f4661b
Contents?: true
Size: 516 Bytes
Versions: 55
Compression:
Stored size: 516 Bytes
Contents
require 'rack/body_proxy' module Rack # Rack::Head returns an empty body for all HEAD requests. It leaves # all other requests unchanged. class Head def initialize(app) @app = app end def call(env) status, headers, body = @app.call(env) if env[REQUEST_METHOD] == HEAD [ status, headers, Rack::BodyProxy.new([]) do body.close if body.respond_to? :close end ] else [status, headers, body] end end end end
Version data entries
55 entries across 53 versions & 14 rubygems