Fix URLs in the `Link` header for `GET /projects/:id/repository/contributors` when no value is passed for `order_by` or `sort`
requested to merge 45363-optional-params-on-api-endpoint-produce-invalid-pagination-header-links into master
What does this MR do?
This fixes URLs in the Link
header for GET /projects/:id/repository/contributors
when no value is passed for order_by
or sort
.
Are there points in the code the reviewer needs to double check?
A more robust (but also with potential bigger/unknown consequences) would be to replace params
with declared_params(include_missing: false)
in API::Helpers::Pagination#pagination_links
(I've quickly checked and that seems to work).
Why was this MR needed?
To fix a regression where the URLs generated in the Link
header for GET /projects/:id/repository/contributors
would be incorrect and return a order_by does not have a valid value, sort does not have a valid value
error.
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Review
-
Has been reviewed by Backend
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Squashed related commits together -
Internationalization required/considered -
End-to-end tests pass ( package-and-qa
manual pipeline job)
What are the relevant issue numbers?
Closes #45363 (closed)
Edited by Rémy Coutable