From f9ccf1860bf6ca7b9869c834f5c8bae1e25d4c38 Mon Sep 17 00:00:00 2001 From: Prox Date: Wed, 4 Mar 2026 00:01:38 +0200 Subject: [PATCH] fix: correct events endpoint path and error body handling --- src/netbird/client.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/netbird/client.ts b/src/netbird/client.ts index e6f162e..e2ccd25 100644 --- a/src/netbird/client.ts +++ b/src/netbird/client.ts @@ -65,11 +65,12 @@ export class NetbirdClient { }); if (!resp.ok) { + const text = await resp.text(); let errorBody: unknown; try { - errorBody = await resp.json(); + errorBody = JSON.parse(text); } catch { - errorBody = await resp.text(); + errorBody = text; } throw new NetbirdApiError(resp.status, method, path, errorBody); } @@ -123,7 +124,7 @@ export class NetbirdClient { return this.request("POST", "/setup-keys", data); } - deleteSetupKey(id: number): Promise { + deleteSetupKey(id: number | string): Promise { return this.request("DELETE", `/setup-keys/${id}`); } @@ -220,6 +221,6 @@ export class NetbirdClient { // --------------------------------------------------------------------------- listEvents(): Promise { - return this.request("GET", "/events"); + return this.request("GET", "/events/audit"); } }