I'm trying to write some Rack Middleware for a Rails 4.2 app that alters the response body using the gsub
method. I found older examples that use a pattern like this:
class MyMiddleware
def initialize(app)
@app = app
end
def call(env)
status, headers, response = @app.call(env)
# do some stuff
[status, headers, response]
end
end
What I'm finding is that there is no setter method for response.body
. Is there another pattern I can start with to go about modifying the body?
make_new_response
? – Abdominous