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

--- Comment #32 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 202875
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202875&action=edit
Bug 36369: (follow-up) Use declarative embed in the remaining API clients

Bug 36369 introduced KohaApiClient with a declarative `embed` parameter,
but only item-api-client.js was converted to use it. The remaining
clients still built the x-koha-embed header by hand.

This patch replaces the 20 remaining hardcoded
`headers: { "x-koha-embed": "..." }` blocks with the equivalent
`embed: [...]` declaration:

- acquisition-api-client.js       (2)
- authorised-values-api-client.js (1)
- checkout-api-client.js          (1)
- erm-api-client.js              (10)
- ill-api-client.js               (2)
- preservation-api-client.js      (3)
- sip2-api-client.js              (1)

_resolveEmbed() joins the array with "," so every request goes out with
a byte-identical x-koha-embed header. This patch is a pure refactoring,
no behavior change is intended.

One remaining occurrence, in preservation-api-client.js
waiting_list.get_from_barcode(), is left untouched here: it calls
this.httpClient directly and so bypasses _resolveEmbed(). It is
addressed in a separate patch.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
   k$ qa -c 1
=> SUCCESS: QA passes
3. Exercise the affected modules and confirm, in the browser devtools
   network tab, that the x-koha-embed header sent for each request is
   unchanged from before the patch:
   - ERM: agreements, licenses, local/EBSCO packages, titles, resources
   - Acquisitions: vendor detail and vendor list
   - ILL: supplying request detail, requesting agency detail
   - Preservation: train detail, processing detail, train item detail
   - SIP2: account detail
   - Checkout: renewals modal
   - Any page loading authorised value categories
4. Sign off :-D

Assisted-by: Opus 5 (Anthropic)

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