https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35129

--- Comment #9 from Nick Clemens <n...@bywatersolutions.com> ---
Created attachment 164223
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=164223&action=edit
Bug 35129: Return 400 if _per_page=0 passed

This patch adds a safe guard for when consumers pass _per_page=0 to
endpoints. This condition is checked for on a centralized place and
avoid reaching the controller in such scenarios that would provoke a
division by zero exception.

To test:
1. Apply the regression tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/pagination.t
=> FAIL: We expect a 400, but get a 500 instead
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! No more explosions for this!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomasco...@theke.io>
Signed-off-by: Laura Escamilla <laura.escami...@bywatersolutions.com>
Signed-off-by: Nick Clemens <n...@bywatersolutions.com>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to