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

Tomás Cohen Arazi (tcohen) <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|[email protected] |[email protected]
                   |ity.org                     |
             Status|NEW                         |ASSIGNED

--- Comment #19 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Hi all,

While working on CSRF enforcement for the REST API (Bug 34451), I needed a 
centralized place to handle API-level concerns - CSRF token injection, embed
header handling - without duplicating logic across 26 client files. That led me
to Bug 42753 (cleaning up hardcoded x-koha-embed headers), and then I realized
I was essentially circling back to what I proposed here over two years ago.

So I finally did it. The patch introduces a KohaApiClient base class that all
API clients now extend. It centralizes:

- HttpClient instantiation (no more passing the class as a constructor arg)
- The embed parameter (declarative arrays -> x-koha-embed header,
automatically)
- CSRF token handling (inherited from HttpClient, applied consistently)

All 26 clients are converted. All hardcoded x-koha-embed headers are replaced
with the declarative embed: [...] idiom. This also resolves Bug 42753.

Patches incoming.

PS: I'm happy with the idea of auto-generating the client, but that belongs to
a separate bug IMHO, and can be made on top of this.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
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