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