Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ruby_http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def add_version(url = nil)
# - The url string with the query parameters appended
#
def build_query_params(url, query_params)
params = query_params.map { |key, value| "#{key}=#{value}" }.join('&')
params = URI.encode_www_form(query_params)
url.concat("?#{params}")
end

Expand Down
4 changes: 2 additions & 2 deletions test/test_ruby_http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def test_add_version

def test_build_query_params
url = ''
query_params = { 'limit' => 100, 'offset' => 0 }
query_params = { 'limit' => 100, 'offset' => 0, 'categories' => ['category1', 'category2'] }
url = @client.build_query_params(url, query_params)
assert_equal('?limit=100&offset=0', url)
assert_equal('?limit=100&offset=0&categories=category1&categories=category2', url)
end

def test_build_url
Expand Down