Sha256: daba27675368dcec544e2527adaa361dcd66ab07419676cdb681b287ea9d22fd
Contents?: true
Size: 1.17 KB
Versions: 27
Compression:
Stored size: 1.17 KB
Contents
require 'pact/mock_service/request_handlers/base_administration_request_handler' require 'pact/mock_service/session' module Pact module MockService module RequestHandlers class InteractionPost < BaseAdministrationRequestHandler def initialize name, logger, session, pact_specification_version super name, logger @session = session @pact_specification_version = pact_specification_version end def request_path '/interactions' end def request_method 'POST' end def respond env request_body = env['rack.input'].string parsing_options = { pact_specification_version: pact_specification_version } interaction = Interaction.from_hash(JSON.load(request_body), parsing_options) # Load creates the Pact::XXX classes begin session.add_expected_interaction interaction text_response 'Registered interactions' rescue ::Pact::Error => e text_response e.message, 500 end end private attr_accessor :session, :pact_specification_version end end end end
Version data entries
27 entries across 27 versions & 2 rubygems