Fix MR diffs endpoint to respond with pagination headers
What does this MR do and why?
We previously fixed an issue with MR diffs REST API endpoint that makes it error out when per_page param is higher than the maximum per_page we support (!186318 (merged)).
The fix was to remove the paginate call in code. As a side-effect though, it removes the pagination headers from the response.
To fix that without re-introducing the bug we previously fixed, we now modify the paginate helper to accept a skip_pagination_check param (defaults to false). We set it to true in this endpoint because we are already paginating in #paginated_diffs.
References
Related to #427168 (closed) since !186318 (merged) fixes that
How to set up and validate locally
- Call the endpoint
GET /projects/:id/merge_requests/:merge_request_iid/diffs?per_page=101(per_page > 100) - It shouldn't error out.
- Check the response headers and it should include the pagination headers as documented in https://docs.gitlab.com/api/rest/#pagination.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.