Class: Gitlab::UrlHelpers

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/url_helpers.rb

Constant Summary collapse

WSS_PROTOCOL =
"wss"

Class Method Summary collapse

Class Method Details

.as_wss(url) ⇒ Object


6
7
8
9
10
11
12
13
14
# File 'lib/gitlab/url_helpers.rb', line 6

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