Sha256: 48efe913b6e5d867e6db8541800c320756f11e8b47a419bc198f2f16347efe6e

Contents?: true

Size: 405 Bytes

Versions: 42

Compression:

Stored size: 405 Bytes

Contents

module Rack

class Head
  # Rack::Head returns an empty body for all HEAD requests. It leaves
  # all other requests unchanged.
  def initialize(app)
    @app = app
  end

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

    if env["REQUEST_METHOD"] == "HEAD"
      body.close if body.respond_to? :close
      [status, headers, []]
    else
      [status, headers, body]
    end
  end
end

end

Version data entries

42 entries across 37 versions & 11 rubygems

Version Path
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/rack-1.5.5/lib/rack/head.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/rack-1.5.5/lib/rack/head.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/rack-1.5.5/lib/rack/head.rb
rack-1.5.5 lib/rack/head.rb
rack-1.5.4 lib/rack/head.rb
rack-1.5.3 lib/rack/head.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/head.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/head.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/head.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/head.rb
nanumfont-rails-0.1 vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/head.rb
scout_realtime-1.0.5 lib/vendor/rack-1.5.2/lib/rack/head.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/head.rb
scout_realtime-1.0.4 lib/vendor/rack-1.5.2/lib/rack/head.rb
scout_realtime-1.0.3 lib/vendor/rack-1.5.2/lib/rack/head.rb
scout_realtime-1.0.3.pre lib/vendor/rack-1.5.2/lib/rack/head.rb
scout_realtime-1.0.2 lib/vendor/rack-1.5.2/lib/rack/head.rb
scout_realtime-1.0.1 lib/vendor/rack-1.5.2/lib/rack/head.rb
scout_realtime-1.0.0 lib/vendor/rack-1.5.2/lib/rack/head.rb
scout_realtime-0.5.5 lib/vendor/rack-1.5.2/lib/rack/head.rb