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