2019-07-07 11:18:12 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
class UrlHelpers
|
2019-12-04 20:38:33 +05:30
|
|
|
WSS_PROTOCOL = "wss"
|
2019-07-07 11:18:12 +05:30
|
|
|
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
|