Welcome to mirror list, hosted at ThFree Co, Russian Federation.

router.rb « etag_caching « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 742b72ecde93820592d1b8f8d111e72731c75255 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Gitlab
  module EtagCaching
    module Router
      Route = Struct.new(:regexp, :name, :feature_category, :router) do
        delegate :match, to: :regexp
        delegate :cache_key, to: :router
      end

      module Helpers
        def build_route(attrs)
          EtagCaching::Router::Route.new(*attrs, self)
        end
      end

      # 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)
      end
    end
  end
end