Method: ZipkinTracer::Application.routable_request?

Defined in:
lib/zipkin-tracer/application.rb

.routable_request?(env) ⇒ Boolean

Determines if our framework knows whether the request will be routed to a controller

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
# File 'lib/zipkin-tracer/application.rb', line 5

def self.routable_request?(env)
  return true unless defined?(Rails) # If not running on a Rails app, we can't verify if it is invalid
  path_info = env[ZipkinTracer::RackHandler::PATH_INFO] || ""
  http_method = env[ZipkinTracer::RackHandler::REQUEST_METHOD]
  Rails.application.routes.recognize_path(path_info, method: http_method)
  true
rescue ActionController::RoutingError
  false
end