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

Pagination params not consistently constructed #347

Closed
dugsmith opened this issue Jun 14, 2019 · 0 comments
Closed

Pagination params not consistently constructed #347

dugsmith opened this issue Jun 14, 2019 · 0 comments

Comments

@dugsmith
Copy link
Contributor

I've found an issue in the way pagination params are added to generated URLs. It is easiest to describe in the context of your tests.

On this line of top_level_links_test.rb, you set a custom page_param to page[number]. And when you call Article.all on this line (currently 210), it works.

However, if you change that line to articles = Article.paginate(page: 1).all, then an extra page[] is wrapped around the param, so it becomes ?page[page[number]]=1 in the query string.

I've traced the issue to this line on query/builder.rb.

The problem is that we can't count on whether json_api_client is going to wrap page_param or per_page_param in page[]. I'd like it to be one way or the other.

I'm happy to fix it if you can give me direction as to which way you'd like it to go. It will likely be a breaking change either way. It should either always wrap page params with page[], or never. I'd lean towards always adding page[], since it is that way in the spec. However, we should just be consistent.

Thanks!

dugsmith pushed a commit to dugsmith/json_api_client that referenced this issue Jun 15, 2019
dugsmith pushed a commit to dugsmith/json_api_client that referenced this issue Jun 15, 2019
dugsmith pushed a commit to dugsmith/json_api_client that referenced this issue Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant