Method: Faraday::Utils.escape

Defined in:
lib/faraday/utils.rb

.escape(str) ⇒ Object



30
31
32
33
34
# File 'lib/faraday/utils.rb', line 30

def escape(str)
  str.to_s.gsub(ESCAPE_RE) do |match|
    "%#{match.unpack('H2' * match.bytesize).join('%').upcase}"
  end.gsub(' ', default_space_encoding)
end