Sha256: 63c4a168efa5ed4e38dea7626971b2af88fece3f34d19843ea08d7a5d84f6728
Contents?: true
Size: 399 Bytes
Versions: 23
Compression:
Stored size: 399 Bytes
Contents
require 'digest/md5' module Rack # Automatically sets the ETag header on all String bodies class ETag def initialize(app) @app = app end def call(env) status, headers, body = @app.call(env) if !headers.has_key?('ETag') && body.is_a?(String) headers['ETag'] = %("#{Digest::MD5.hexdigest(body)}") end [status, headers, body] end end end
Version data entries
23 entries across 23 versions & 10 rubygems