Class: Pact::MockService::ControlServer::RequirePacticipantHeaders

Inherits:
Object
  • Object
show all
Defined in:
lib/pact/mock_service/control_server/require_pacticipant_headers.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RequirePacticipantHeaders

Returns a new instance of RequirePacticipantHeaders.



6
7
8
# File 'lib/pact/mock_service/control_server/require_pacticipant_headers.rb', line 6

def initialize app
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/pact/mock_service/control_server/require_pacticipant_headers.rb', line 10

def call env
  if env['HTTP_X_PACT_CONSUMER'] && env['HTTP_X_PACT_PROVIDER']
    @app.call(env)
  else
    [500, {}, ["Please specify the consumer name and the provider name by setting the X-Pact-Consumer and X-Pact-Provider headers"]]
  end
end