Sha256: 09cac5e79133cf6342438585403543c85c667cddd62f25b3f5aa9a79f3cffffe

Contents?: true

Size: 710 Bytes

Versions: 44

Compression:

Stored size: 710 Bytes

Contents

# Decides whether this is a request for the UI or a request for the API
# This is only needed so that UI auth logic is not applied to an API request.
# If it was, a 401 or 403 would be returned before the API got a chance
# to actually handle the request, as it would short circuit the cascade
# logic.

require "rack/pact_broker/request_target"

module Rack
  module PactBroker
    class UIRequestFilter
      include RequestTarget

      def initialize app
        @app = app
      end

      def call env
        if request_for_ui?(env)
          @app.call(env)
        else
          # send the request on to the next app in the Rack::Cascade
          [404, {},[]]
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
pact_broker-2.112.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.111.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.109.1 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.109.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.108.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.107.1 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.107.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.107.0.beta.1 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.106.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.105.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.104.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.103.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.102.2 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.102.1 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.102.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.101.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.100.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.99.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.98.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.97.0 lib/rack/pact_broker/ui_request_filter.rb