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

sse_helpers.rb « helpers « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c354694f508d4a9c766bcd11c8ec62e2f85d2f70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

module API
  module Helpers
    module SSEHelpers
      def request_from_sse?(project)
        return false if request.referer.blank?

        uri = URI.parse(request.referer)
        uri.path.starts_with?(::Gitlab::Routing.url_helpers.project_root_sse_path(project))
      rescue URI::InvalidURIError
        false
      end
    end
  end
end