Sha256: 9a1a7a03486ce0908ce8a02129fb5979edb182ac3fcbb32e56acfc33fca227c8

Contents?: true

Size: 710 Bytes

Versions: 53

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

53 entries across 53 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.79.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.78.1 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.78.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.77.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.76.2 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.76.1 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.76.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.75.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.74.1 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.74.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.73.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.72.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.71.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.70.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.69.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.68.1 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.68.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.67.0 lib/rack/pact_broker/ui_request_filter.rb
pact_broker-2.66.0 lib/rack/pact_broker/ui_request_filter.rb