Sha256: 9337b0775b1dbd98a37832e749af577b4b6ff6540a6f4b6197cdb7a84dc9d711

Contents?: true

Size: 518 Bytes

Versions: 3

Compression:

Stored size: 518 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cas-client-0.1.2.pre.p19 lib/cas/client/rack.rb
cas-client-0.1.2.pre.p18 lib/cas/client/rack.rb
cas-client-0.1.2.pre.p17 lib/cas/client/rack.rb