Sha256: 91f0cedb5312343fc0db6aa5c98dae129cd7667fe759576295ac68c7362a96b2

Contents?: true

Size: 608 Bytes

Versions: 12

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

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.89.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.88.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.87.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.86.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.85.1 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.85.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.84.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.83.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.82.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.81.0 spec/support/webhook_endpoint_middleware.rb
pact_broker-2.80.0 spec/support/webhook_endpoint_middleware.rb