Sha256: 8702912371f022842707455aba9223c7b327bdda8394d73c654c332352e5b9d7

Contents?: true

Size: 608 Bytes

Versions: 66

Compression:

Stored size: 608 Bytes

Contents

module PactBroker
  class WebhookEndpointMiddleware
    def initialize app
      @app = app
    end

    def call(env)
      if env['PATH_INFO'] == '/pact-changed-webhook'
        body = env['rack.input'].read
        puts body
        PactBroker::VerificationJob.perform_in(2, JSON.parse(body, symbolize_names: true))
        [200, {}, ["Pact changed webhook executed"]]
      elsif env['PATH_INFO'] == '/verification-published-webhook'
        body = env['rack.input'].read
        puts body
        [200, {}, ["Verification webhook executed"]]
      else
        @app.call(env)
      end
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
pact_broker-2.36.1 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.36.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.35.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.34.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.33.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.32.0 spec/support/webhook_endpoint_middleware.rb