Created
July 31, 2013 12:25
-
-
Save lfborjas/6121551 to your computer and use it in GitHub Desktop.
inspect the rack env before it hits the rails app
This file contains 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
#config/application.rb | |
config.middleware.use "Peekaboo" |
This file contains 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
#put this in lib/peekaboo.rb | |
class Peekaboo | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
puts env.inspect | |
#here's where it hits the rails app, you could change anything in env before it | |
status, headers, response = @app.call(env) | |
[status, headers, response] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment