bitpay / ruby-client

Powerful, flexible, lightweight SDK for the BitPay Bitcoin Payment Gateway API.
MIT License
79 stars 64 forks source link

client.get applies token incorrectly when query params are present #39

Closed heisler3030 closed 9 years ago

heisler3030 commented 9 years ago

Because client.get appends ?token=<token> directly to the passed GET path, this causes issues if query params are already attached, because now there are two ?'s in the string.

Proposed fix: add logic to substitute & if there is already a ? in the path.

Test case:

client.get(path: "ledgers/BTC?startDate=2015-01-01&endDate=2015-02-01" token: token)

philosodad commented 9 years ago

There's a workaround to this problem right now (don't pass the token as an argument, add it to the path) so I'd call this a medium to low priority bug. Might be worth fixing when we fix the other bug.

heisler3030 commented 9 years ago

Proposed fix: https://github.com/bitpay/ruby-client/pull/41

heisler3030 commented 9 years ago

Fixed with merge as above