Sha256: 9e5442f3a0a10e974dbaaed9cff2b34be8351deb32d4b3c103d8ffd3661bb36c
Contents?: true
Size: 499 Bytes
Versions: 16
Compression:
Stored size: 499 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') parts = [] body.each { |part| parts << part.to_s } headers['ETag'] = %("#{Digest::MD5.hexdigest(parts.join(""))}") [status, headers, parts] else [status, headers, body] end end end end
Version data entries
16 entries across 15 versions & 6 rubygems