Sha256: b8515284f6d733897b5e4177195fcd5d86818cab5d0f23d20620c6958b1ac924

Contents?: true

Size: 649 Bytes

Versions: 2

Compression:

Stored size: 649 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.respond_to?("body") && 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.p16 lib/cas/client/rack.rb
cas-client-0.1.2.pre.p15 lib/cas/client/rack.rb