Skip to content

Instantly share code, notes, and snippets.

@dropwhile
Created December 22, 2010 23:00
Show Gist options
  • Save dropwhile/752247 to your computer and use it in GitHub Desktop.
Save dropwhile/752247 to your computer and use it in GitHub Desktop.
Rack::Date middleware
## Rack middleware for adding a Date http header
## Some http servers do not set this, so use only if necessary
require 'time'
module Rack
class Date
def initialize(app)
@app = app
end
def call(env)
status, headers, response = @app.call(env)
headers['Date'] ||= Time.now.httpdate
[status, headers, response]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment