Skip to content

Instantly share code, notes, and snippets.

@karmi
Forked from kubicek/gist:110914
Created May 13, 2009 07:09
Show Gist options
  • Save karmi/110918 to your computer and use it in GitHub Desktop.
Save karmi/110918 to your computer and use it in GitHub Desktop.
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