Class: Rack::PactBroker::UIRequestFilter

Inherits:
Object
  • Object
show all
Includes:
RequestTarget
Defined in:
lib/rack/pact_broker/ui_request_filter.rb

Constant Summary

Constants included from RequestTarget

RequestTarget::API_CONTENT_TYPES, RequestTarget::WEB_ASSET_EXTENSIONS

Instance Method Summary collapse

Methods included from RequestTarget

#request_for_api?, #request_for_ui?

Constructor Details

#initialize(app) ⇒ UIRequestFilter

Returns a new instance of UIRequestFilter.



14
15
16
# File 'lib/rack/pact_broker/ui_request_filter.rb', line 14

def initialize app
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/rack/pact_broker/ui_request_filter.rb', line 18

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