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.79.1 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.79.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.78.1 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.78.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.77.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.76.2 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.76.1 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.76.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.75.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.74.1 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.74.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.73.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.72.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.71.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.70.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.69.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.68.1 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.68.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.67.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.66.0 spec/support/webhook_endpoint_middleware.rb