From 941093b2cf6deec8f3d4118f494a1ee96a2c50af Mon Sep 17 00:00:00 2001 From: Marc Villain Date: Sun, 3 May 2026 18:19:39 +0200 Subject: [PATCH] feat(core): add webhooks --- src/proxy.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/proxy.ts b/src/proxy.ts index 4bb704f..a905306 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -80,6 +80,15 @@ export function createProxyRegistry(db: Pool, postgrestUrl: string): ProxyRegist pick('prefer', 'Prefer'); pick('accept', 'Accept'); + if (req.method === 'POST' || req.method === 'PATCH' || req.method === 'DELETE') { + const existing = headers['Prefer']; + if (!existing || !existing.includes('return=')) { + headers['Prefer'] = existing + ? `${existing}, return=representation` + : 'return=representation'; + } + } + const hasBody = req.method !== 'GET' && req.method !== 'HEAD' && req.body != null; const body = hasBody ? JSON.stringify(req.body) : undefined;