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

--- Comment #2 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 203350
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203350&action=edit
Bug 43196: Regression tests for PUT /biblios with malformed bodies

MARC::Record::new_from_mij_structure silently returns an empty record
when passed undef or an invalid structure. The PUT /biblios endpoint
does not validate the parsed record before calling ModBiblio, resulting
in a 200 response for clearly invalid input.

This patch adds regression tests for all three supported content types:

- application/marc-in-json: truncated JSON, invalid structure, empty fields
- application/marcxml+xml: truncated XML, empty record
- application/marc: garbage input

All should return 400 but currently return 200.

Note: MARC::Record::MiJ upstream should arguably croak on undef/invalid
input rather than returning a blank record.

Test plan:
1. Apply patch
2. Run:
   $ prove t/db_dependent/api/v1/biblios.t
=> FAIL: put() malformed body tests fail (200 instead of 400)
3. Sign off :-D

Signed-off-by: Tomás Cohen Arazi <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to