Created
May 13, 2009 06:58
-
-
Save kubicek/110914 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
class KubicekMiddleware | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
#tohle se vola pred aplikaci | |
env["REQUEST_URI"]="/welcome" | |
#zavolame aplikaci | |
status, headers, response = @app.call(env) | |
#tohle se vola po aplikaci | |
new_response = [] | |
response.each do |part| | |
new_response << part.gsub(/World/, 'Middleware') | |
end | |
[status, headers, new_response] | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment