-
-
Save pedrodelgallego/254903 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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