From 4047222905e66e1d38d712e746f349719f5ffe32 Mon Sep 17 00:00:00 2001 From: Speccycy Date: Sun, 4 Oct 2026 15:51:29 +0700 Subject: [PATCH 1/2] Send JSON body with WARDOGS kill requests --- src/lib/server/actions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/server/actions.ts b/src/lib/server/actions.ts index c4e64e27..1a9e279c 100644 --- a/src/lib/server/actions.ts +++ b/src/lib/server/actions.ts @@ -656,7 +656,7 @@ export const ACTIONS: Record = { cap: 'players.kill', mutating: true, target: (p) => str(p.steamId, 32), - run: (c, p) => c.json('POST', `/v1/players/${steamId(p.steamId)}/kill`) + run: (c, p) => c.json('POST', `/v1/players/${steamId(p.steamId)}/kill`, {}) }, // As the official console does it: move the faction, then kill the player so they respawn on the // new side. A failed kill is not an error; the move already happened. A kill refused for sending @@ -676,7 +676,7 @@ export const ACTIONS: Record = { let respawned = true; let retryAfterMs = 0; try { - await c.json('POST', `/v1/players/${id}/kill`); + await c.json('POST', `/v1/players/${id}/kill`, {}); } catch (err) { if (!(err instanceof GameError)) throw err; respawned = false; From fec51956a82f43563b3f3b15ba6f969f94885ae5 Mon Sep 17 00:00:00 2001 From: Speccycy Date: Sun, 4 Oct 2026 15:51:46 +0700 Subject: [PATCH 2/2] Test JSON bodies for kill requests --- src/lib/server/actions.test.ts | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/lib/server/actions.test.ts b/src/lib/server/actions.test.ts index 29992596..d5992893 100644 --- a/src/lib/server/actions.test.ts +++ b/src/lib/server/actions.test.ts @@ -35,6 +35,50 @@ test('changeTeam moves the faction then kills the player', async () => { expect(r.message).toContain('respawn'); }); +test('kill sends an empty JSON body', async () => { + const calls: { method: string; path: string; body: unknown }[] = []; + const client: any = { + json: async (method: string, path: string, body?: unknown) => { + calls.push({ method, path, body }); + return { message: 'OK: killed Player.' }; + } + }; + await ACTIONS.kill.run(client, { steamId: '76561198000000001' }); + expect(calls).toEqual([ + { + method: 'POST', + path: '/v1/players/76561198000000001/kill', + body: {} + } + ]); +}); + +test('changeTeam sends an empty JSON body with its respawn kill', async () => { + const calls: { method: string; path: string; body: unknown }[] = []; + const client: any = { + json: async (method: string, path: string, body?: unknown) => { + calls.push({ method, path, body }); + return { message: 'OK.' }; + } + }; + await ACTIONS.changeTeam.run(client, { + steamId: '76561198000000001', + faction: 'Valkyra' + }); + expect(calls).toEqual([ + { + method: 'PATCH', + path: '/v1/players/76561198000000001', + body: { faction: 'Valkyra' } + }, + { + method: 'POST', + path: '/v1/players/76561198000000001/kill', + body: {} + } + ]); +}); + test('changeTeam tolerates a failed kill', async () => { const { client, calls } = fakeClient(true); const r: any = await ACTIONS.changeTeam.run(client, {