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

Admin API query parameter size is not reported in the next URL in paginated lists #9029

Closed
1 task done
Teudimundo opened this issue Jun 29, 2022 · 1 comment · Fixed by #9503
Closed
1 task done
Labels
core/admin-api good first issue Issues that beginners/volunteers can easily help with.

Comments

@Teudimundo
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Kong version ($ kong version)

2.1.8

Current Behavior

When doing the following request:

GET http://localhost:8001/services?tags=test&size=1

The response contains a single item as expected by the size argument (I could not find it documented in the Kong Admin API, anyway)

but in the next field the contained URL is:

"next": "/services?offset=WyIzZWQ2N2EwMC1mNGY2LTQ4NTUtYmQ0Yi0zMmZmMWMzNWVmNmMiXQ&tags=test" 

the tags parameter is present, but size is missing.

Expected Behavior

The size parameter should have been present so that the pagination will keep respecting the size the user requested:

"next": "/services?offset=WyIzZWQ2N2EwMC1mNGY2LTQ4NTUtYmQ0Yi0zMmZmMWMzNWVmNmMiXQ&tags=test" 

Steps To Reproduce

1. Do the request: `GET http://localhost:8001/services?tags=test&size=1`
2. Verify that the `next` field in the response lacks the `size` parameter

Anything else?

No response

@mayocream mayocream added the good first issue Issues that beginners/volunteers can easily help with. label Sep 21, 2022
@aj-ya
Copy link

aj-ya commented Sep 22, 2022

Hey! @mayocream I would like to work on this issue.
If I'm not wrong the change is required in the /kong/api/endpoints.lua right?
and something along the lines of

if args.size then
      next_page_size = "&size=" .. escape_uri(type(args.size) == "number" and args.size[1] or args.size)
end

I'm a bit new to the codebase and Lua itself, so any suggestions and guidance are much appreciated...

jacksjm added a commit to jacksjm/kong that referenced this issue Oct 7, 2022
dndx pushed a commit to jacksjm/kong that referenced this issue Oct 31, 2022
fffonion pushed a commit that referenced this issue Nov 1, 2022
Fix to propagate the size parameter to perform the next request, ensuring the same size in requests

Fix #9029
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core/admin-api good first issue Issues that beginners/volunteers can easily help with.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants