Sha256: f119fab2dbd4bdedfa76c3ec3caea4085262349ced5d5831554a19dedc65b430

Contents?: true

Size: 543 Bytes

Versions: 8

Compression:

Stored size: 543 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

8 entries across 8 versions & 1 rubygems

Version Path
headhunter-0.1.4 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.1.3 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.1.2 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.1.1 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.1.0 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.0.9 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.0.8 lib/headhunter/rack/capturing_middleware.rb
headhunter-0.0.7 lib/headhunter/rack/capturing_middleware.rb