gitlab-org--gitlab-foss/lib/gitlab/url_helpers.rb
Francisco Javier López 8a134f4c65 Renamed terminal_specification to channel_specification
We're moving from using terminology related to terminals when
we refer to Websockets connections in Workhorse.
It's more appropiate a concept like channel.
2019-04-04 18:32:02 +00:00

16 lines
298 B
Ruby

# frozen_string_literal: true
module Gitlab
class UrlHelpers
WSS_PROTOCOL = "wss".freeze
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