lib/wunderbar/cgi-methods.rb in wunderbar-0.10.9 vs lib/wunderbar/cgi-methods.rb in wunderbar-0.11.0
- old
+ new
@@ -1,5 +1,7 @@
+require 'digest/md5'
+
module Wunderbar
module CGI
# produce json
def self.json(scope, &block)
@@ -29,10 +31,9 @@
end
# Conditionally provide output, based on ETAG
def self.out?(scope, headers, &block)
content = block.call
- require 'digest/md5'
etag = Digest::MD5.hexdigest(content)
if scope.env['HTTP_IF_NONE_MATCH'] == etag.inspect
headers['Date'] = ::CGI.rfc1123_date(Time.now)
scope.out headers.merge('status' => '304 Not Modified') do