module Stormpath::Http::Utils
Public Instance Methods
default_port?(uri)
click to toggle source
# File lib/stormpath-sdk/http/utils.rb 19 def default_port?(uri) 20 scheme = uri.scheme.downcase 21 port = uri.port 22 port <= 0 || (port == 80 && scheme.eql?('http')) || (port == 443 && scheme.eql?('https')) 23 end
encode_url(value, path, canonical)
click to toggle source
# File lib/stormpath-sdk/http/utils.rb 25 def encode_url(value, path, canonical) 26 value = value.to_s 27 return encoded_chars?(value) ? URI.encode(URI.decode(value)) : URI.encode(value) if path 28 29 CGI.escape(value.to_s).tap do |encoded| 30 str_map = { '+' => '%20', '%7E' => '~' } 31 str_map.each do |key, str_value| 32 encoded.gsub!(key, str_value) if encoded.include? key 33 end 34 end 35 end
encoded_chars?(string)
click to toggle source
# File lib/stormpath-sdk/http/utils.rb 37 def encoded_chars?(string) 38 string.include?('%2E') 39 end