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

--- Comment #3 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 200646
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200646&action=edit
Bug 42869: (follow-up) Add render_job_accepted helper

This patch adds a render_job_accepted($job) helper to the
Koha::REST::Plugin::Responses plugin. It takes a Koha::BackgroundJob
object, sets the Location header to the job tracking URL, and renders
202 Accepted with the full job representation via $c->objects->to_api.

This mirrors the existing render_resource_deleted and
render_resource_not_found helpers and makes the coding guideline
(REST3.2.1.2) trivially enforceable.

Changes:
- Add render_job_accepted helper to Koha::REST::Plugin::Responses
- Refactor CoverImages and ERM import_from_list to use the helper
- ERM import_from_kbart_file keeps explicit render (non-standard body)
- Response body is now the full job object (callers still get job_id)
- OpenAPI specs reference the job definition for 202 responses
- Add unit test for the helper in responses.t

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/responses.t
=> SUCCESS: Tests pass!
  k$ prove t/db_dependent/api/v1/cover_images.t
=> SUCCESS: Tests pass!
  k$ prove t/db_dependent/api/v1/erm_eholdings_titles.t
=> SUCCESS: Tests pass!
3. Sign off :-D

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
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