chat/htmx: CSRF-заголовок для всех htmx-запросов

hx-post вне формы (кнопка «Синхронизировать чат») слал POST без CSRF —
Forbidden (CSRF token missing). Добавил hx-headers с X-CSRFToken на <body>:
токен уходит со всеми htmx-запросами, работает и при CSRF_COOKIE_HTTPONLY.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-16 20:35:07 +03:00
parent 58efe33070
commit 2a1571ef73
+1 -1
View File
@@ -50,7 +50,7 @@
<script src="{% static 'assets/js/chat.js' %}"></script>
<script src="{% static 'assets/js/documents.js' %}"></script>
</head>
<body>
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
<script>
function isMobile() { return window.innerWidth < 768; }