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}" rack_body.body += "CAS Client Called!!!" headers["Content-Length"] = body.length.to_s [status, headers, rack_body] end end end end