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

--- Comment #16 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 200835
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200835&action=edit
Bug 42404: (follow-up) Return 202 Accepted with Location header

The batch cover image import endpoint enqueues a background job for
processing. A 201 Created is incorrect because no resource is durably
created at response time - the work is deferred. This patch changes
the response to 202 Accepted, which is the correct HTTP status for
async job submission.

Additionally, the Location header is set to the job tracking endpoint
so clients can poll for completion status without out-of-band knowledge.

Changes:
- Return 202 instead of 201 from batch_import controller
- Set Location header to /api/v1/jobs/{job_id}
- Update OpenAPI spec to document 202 response and Location header
- Update tests to assert 202 status and Location header

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/cover_images.t
=> SUCCESS: Tests pass!
3. Verify the OpenAPI spec is valid:
  k$ cd /kohadevbox/koha && perl t/db_dependent/api/v1/spec.t
=> SUCCESS: Spec validates!
4. Sign off :-D

Signed-off-by: Martin Renvoize <[email protected]>

-- 
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