Skip to content

Instantly share code, notes, and snippets.

@pius
Created November 16, 2009 04:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pius/235733 to your computer and use it in GitHub Desktop.
Save pius/235733 to your computer and use it in GitHub Desktop.
module Rack
class AllYourBase
def initialize(app, options = {})
@app = app
@options = options
end
def call(env)
@request = Rack::Request.new(env)
status, @headers, @body = @app.call(env)
@body = "All your base are belong to us"
update_content_length
[status, @headers, @body]
end
private
def update_content_length
@headers['Content-Length'] = Rack::Utils.bytesize(@body).to_s
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment