2019-04-04 14:32:02 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
class UrlHelpers
|
2019-08-31 15:25:25 -04:00
|
|
|
WSS_PROTOCOL = "wss"
|
2019-04-04 14:32:02 -04:00
|
|
|
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
|