In Files

Parent

Methods

Class/Module Index [+]

Quicksearch

Rack::ETag

Automatically sets the ETag header on all String bodies

Public Class Methods

new(app) click to toggle source
# File lib/rack/etag.rb, line 6
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/rack/etag.rb, line 10
def call(env)
  status, headers, body = @app.call(env)

  if !headers.has_key?('ETag')
    digest, body = digest_body(body)
    headers['ETag'] = %("#{digest}")
  end

  [status, headers, body]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.