Sha256: bafef525f3484486943699732752cb4e0df36b6c6d668377089ad434a5c4dddc

Contents?: true

Size: 647 Bytes

Versions: 2

Compression:

Stored size: 647 Bytes

Contents

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}"

        if rack_body.class == RackBody && rack_body.body.class == String
          response = rack_body.body
          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

2 entries across 2 versions & 1 rubygems

Version Path
cas-client-0.1.2.pre.p14 lib/cas/client/rack.rb
cas-client-0.1.2.pre.p13 lib/cas/client/rack.rb