Sha256: 4456ca1729686c9e8494967f4f135cdcf26286b2b805c7c2651d54e0c8145db0

Contents?: true

Size: 975 Bytes

Versions: 80

Compression:

Stored size: 975 Bytes

Contents

require 'pact/consumer/mock_service/rack_request_helper'
require 'pact/mock_service/request_handlers/base_request_handler'

module Pact
  module MockService
    module RequestHandlers
      class BaseAdministrationRequestHandler < BaseRequestHandler

        attr_accessor :logger, :name

        def initialize name, logger
          @name = name
          @logger = logger
        end

        def match? env
          has_mock_service_header?(env) && path_matches?(env) && method_matches?(env)
        end

        def has_mock_service_header? env
          env['HTTP_X_PACT_MOCK_SERVICE']
        end

        def path_matches? env
          env['PATH_INFO'].chomp("/") == request_path
        end

        def method_matches? env
          env['REQUEST_METHOD'] == request_method
        end

        def request_path
          raise NotImplementedError
        end

        def request_method
          raise NotImplementedError
        end
      end
    end
  end
end

Version data entries

80 entries across 80 versions & 2 rubygems

Version Path
pact-mock_service-3.12.3 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.12.2 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.12.1 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.12.0 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.11.2 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.11.1 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.11.0 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.10.0 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
hs-pact-mock_service-3.9.2 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.9.1 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.9.0 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.8.0 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.7.0 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.6.2 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.6.1 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.6.0 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.5.0 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.4.0 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.3.1 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb
pact-mock_service-3.3.0 lib/pact/mock_service/request_handlers/base_administration_request_handler.rb