Module: Rack::PactBroker::RequestTarget

Extended by:
RequestTarget
Included in:
PactBroker::Api::Middleware::HttpDebugLogs, RequestTarget, UIRequestFilter
Defined in:
lib/rack/pact_broker/request_target.rb

Constant Summary collapse

WEB_ASSET_EXTENSIONS =
%w[.js .woff .woff2 .css .png .html .map .ttf .ico].freeze
API_CONTENT_TYPES =
%w[application/hal+json application/problem+json application/json text/csv application/yaml text/plain].freeze

Instance Method Summary collapse

Instance Method Details

#request_for_api?(env) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/rack/pact_broker/request_target.rb', line 16

def request_for_api?(env)
  explicit_request_for_api(env) || no_accept_header(env) || is_badge_request?(env) || (accept_all(env) && !is_web_extension(env))
end

#request_for_ui?(env) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/rack/pact_broker/request_target.rb', line 12

def request_for_ui?(env)
  !(request_for_api?(env))
end