Koha-clms/Koha/REST
Tomas Cohen Arazi 308bb0830c
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 <tomascohen@theke.io>
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-04-04 15:24:34 +02:00
..
Plugin Bug 36421: Make sure pre-controller errors are correctly logged 2024-04-04 15:24:29 +02:00
V1 Bug 35129: Return 400 if _per_page=0 passed 2024-04-04 15:24:34 +02:00
V1.pm Bug 34271: Remove a few Logger statements from REST API 2023-10-18 10:26:03 -03:00