fix(web): n'envoie pas content-type json sans corps (DELETE conversation) (v0.36.1)
Fastify rejetait le body vide annoncé application/json (FST_ERR_CTP_EMPTY_JSON_BODY) sur DELETE /api/conversations/:id. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016w5jRe87MGdd6AMvXQcHNi
This commit is contained in:
@@ -6,6 +6,12 @@ incompatibles. Chaque ligne renvoie à un commit dédié (un artefact = un commi
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.36.1] — 2026-06-23 — fix DELETE conversation (body vide)
|
||||||
|
### Fixed
|
||||||
|
- Client web `req()` : `content-type: application/json` n'est plus envoyé sur
|
||||||
|
les requêtes **sans corps** (DELETE) — Fastify rejetait le body vide
|
||||||
|
(`FST_ERR_CTP_EMPTY_JSON_BODY`). La suppression de conversation fonctionne.
|
||||||
|
|
||||||
## [0.36.0] — 2026-06-23 — conversations persistantes (mémoire multi-tour)
|
## [0.36.0] — 2026-06-23 — conversations persistantes (mémoire multi-tour)
|
||||||
### Added
|
### Added
|
||||||
- **`conversations/store.ts`** : store SQLite (conversations + messages) avec
|
- **`conversations/store.ts`** : store SQLite (conversations + messages) avec
|
||||||
|
|||||||
+4
-1
@@ -37,7 +37,10 @@ export class ApiError extends Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function req<T>(path: string, token: string | null, init?: RequestInit): Promise<T> {
|
async function req<T>(path: string, token: string | null, init?: RequestInit): Promise<T> {
|
||||||
const headers: Record<string, string> = { "content-type": "application/json" };
|
const headers: Record<string, string> = {};
|
||||||
|
// content-type seulement s'il y a un corps : sinon Fastify rejette un body
|
||||||
|
// vide annoncé en application/json (DELETE, etc.).
|
||||||
|
if (init?.body != null) headers["content-type"] = "application/json";
|
||||||
if (token) headers.authorization = `Bearer ${token}`;
|
if (token) headers.authorization = `Bearer ${token}`;
|
||||||
const res = await fetch(`/api${path}`, { ...init, headers: { ...headers, ...(init?.headers as Record<string, string>) } });
|
const res = await fetch(`/api${path}`, { ...init, headers: { ...headers, ...(init?.headers as Record<string, string>) } });
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
|
|||||||
Reference in New Issue
Block a user