module Cas module Client class Rack def initialize(app) @app = app end def call(env) puts "CAS Client Called from Rack!" status, headers, rack_body = @app.call(env) puts "Middleware called. Status: #{status}, Headers: #{headers}" response = rack_body.body response += "CAS Client Called!!!" headers["Content-Length"] = response.length.to_s [status, headers, [response]] end end end end