Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using prev/next cursors continually adds too many random numbers to querystring #169

Closed
vcarl opened this issue May 30, 2018 · 1 comment

Comments

@vcarl
Copy link
Contributor

vcarl commented May 30, 2018

The CallBuilder class always adds a random string to get around the cache, and it doesn't get removed by the backend when it builds the next/prev/self links. This means every time the prev/next functions are called, the URL gets longer. After polling for new trades for a while, I ended up with

https://horizon.stellar.org/trades
?base_asset_type=native
&c=0.7701431022730245
&c=0.4970337975240551
&c=0.07568927670193881
&c=0.7113043831916186
&c=0.09741669585793411
&c=0.9634440653137242
&c=0.7952843831838561
&c=0.4240534929325275
&c=0.9077095637476096
&c=0.4545434659180798
&c=0.6947631341816114
&c=0.49686492877708144
&c=0.7644129797904986
&c=0.9781990404740941
&c=0.6122502549735962
&c=0.2561399182905837
&c=0.14784270381840492
&counter_asset_code=HKDT
&counter_asset_issuer=GABSZVZBYEO5F4V5LZKV7GR4SAJ5IKJGGOF43BIN42FNDUG7QPH6IMRQ
&counter_asset_type=credit_alphanum4
&cursor=77931417081745409-0
&limit=10
&order=asc

Looks like changing this line to replace instead of add would fix the issue. https://github.com/stellar/js-stellar-sdk/blob/master/src/call_builder.js#L165

@nullstyle
Copy link
Contributor

The proposed solution, making sure the c value is replaced instead of appended onto the query string, seems like the correct solution to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants