2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
module Gitlab
|
|
|
|
module EtagCaching
|
2021-04-17 20:07:23 +05:30
|
|
|
module Router
|
|
|
|
Route = Struct.new(:regexp, :name, :feature_category, :router) do
|
|
|
|
delegate :match, to: :regexp
|
|
|
|
delegate :cache_key, to: :router
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
module Helpers
|
|
|
|
def build_route(attrs)
|
|
|
|
EtagCaching::Router::Route.new(*attrs, self)
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
# Performing RESTful routing match before GraphQL would be more expensive
|
|
|
|
# for the GraphQL requests because we need to traverse all of the RESTful
|
|
|
|
# route definitions before falling back to GraphQL.
|
|
|
|
def self.match(request)
|
|
|
|
Router::Graphql.match(request) || Router::Restful.match(request)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|