Skip to content

Commit

Permalink
Use URI.decode_www_form method for until parameter only once in a query
Browse files Browse the repository at this point in the history
  • Loading branch information
kangkyu committed Apr 18, 2017
1 parent 433090a commit f1d816c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/funky/connections/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def self.fetch_multiple_pages(uri)
[]
else
@previous_timestamp = timestamp
uri.query = uri.query + "&until=#{Time.parse(timestamp).to_i}"
new_query = URI.decode_www_form(uri.query).to_h.merge('until' => Time.parse(timestamp).to_i)
uri.query = URI.encode_www_form(new_query)
json[:data] + fetch_multiple_pages(uri)
end
end
Expand Down

0 comments on commit f1d816c

Please sign in to comment.