Module: HttpStub::Extensions::Core::URI::ClassMethods

Defined in:
lib/http_stub/extensions/core/uri.rb

Instance Method Summary collapse

Instance Method Details

#add_parameters(uri, parameters) ⇒ Object


13
14
15
16
17
18
# File 'lib/http_stub/extensions/core/uri.rb', line 13

def add_parameters(uri, parameters)
  parsed_uri = ::URI.parse(uri)
  existing_parameters = ::URI.decode_www_form(parsed_uri.query || "").to_h
  parsed_uri.query = ::URI.encode_www_form(existing_parameters.merge(parameters))
  parsed_uri.to_s
end