https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36369 --- Comment #26 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 200639 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200639&action=edit Bug 36369: (follow-up) Move CSRF token handling from HttpClient to KohaApiClient HttpClient is a generic HTTP utility with no knowledge of Koha. CSRF tokens are a Koha API concern: generated server-side by Koha::Token->generate_csrf() and embedded in the page's meta tag. This patch moves CSRF responsibility to the correct layer: - KohaApiClient._readCsrfToken() reads the token from the DOM - KohaApiClient._withCsrf() injects the CSRF-TOKEN header into state-changing requests (post, put, patch, delete) - HttpClient no longer has any CSRF awareness This makes HttpClient reusable as a generic fetch wrapper, and keeps Koha-specific API semantics (embed, CSRF) centralized in KohaApiClient. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.