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

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

module Gitlab
  class UrlHelpers
    WSS_PROTOCOL = "wss"
    def self.as_wss(url)
      return unless url.present?

      URI.parse(url).tap do |uri|
        uri.scheme = WSS_PROTOCOL
      end.to_s
    rescue URI::InvalidURIError
      nil
    end
  end
end