Sha256: 2992abea8a7362c313b02e1cce0a02a26afd0ba2c99f5d1b09c15c57d05c1a3d

Contents?: true

Size: 542 Bytes

Versions: 5

Compression:

Stored size: 542 Bytes

Contents

module Headhunter
  module Rack
    class CapturingMiddleware
      def initialize(app, headhunter)
        @app = app
        @hh  = headhunter
      end

      def call(env)
        response = @app.call(env)
        process(response)
        response
      end

      def process(rack_response)
        status, headers, response = rack_response

        if html = extract_html_from(response)
          @hh.process('unknown', html)
        end
      end

      def extract_html_from(response)
        response[0]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
headhunter-0.1.9 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.1.8 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.1.7 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.1.6 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.1.5 lib/headhunter/rack/capturing_middleware.rb