Created
June 18, 2018 14:55
-
-
Save johnmeehan/59d1d1ff88bee5846900430d133a4a97 to your computer and use it in GitHub Desktop.
Middleware to print to the screen so I can see the responses when streaming data
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
# app/config/environments/development.rb | |
# Middleware to print to the screen so I can see the responses when streaming data | |
config.middleware.use( | |
Class.new do | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
status, headers, response = @app.call(env) | |
response.each do |r| | |
puts "########### REQUEST ##########\n" | |
end | |
[status, headers, response] | |
end | |
end | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment