Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix(api-client): accept empty no-content responses (#2237)
Selene299eacc8777643
diff --git a/packages/api-client/src/client.ts b/packages/api-client/src/client.tsindex a4e426d42..cb1b154a7 100644--- a/packages/api-client/src/client.ts+++ b/packages/api-client/src/client.ts@@ -91,6 +91,7 @@ async function handleResponse<T>(res: Response): Promise<T> {}throw new ApiClientError(res.status, detail);}+ if (res.status === 204) return undefined as T;return res.json() as Promise<T>;}diff --git a/packages/api-client/src/providers-response.test.ts b/packages/api-client/src/providers-response.test.tsnew file mode 100644index 000000000..5f721adeb--- /dev/null+++ b/packages/api-client/src/providers-response.test.ts@@ -0,0 +1,23 @@+import { beforeEach, describe, expect, it } from "vitest";++import { configureApiClient } from "./client";+import { addProviderKey, removeProviderKey } from "./providers";++describe("provider key responses", () => {+ beforeEach(() => {+ configureApiClient({+ baseUrl: "http://test.local",+ fetch: async () => new Response(null, { status: 204 }),+ });+ });++ it("accepts the empty successful save response", async () => {+ await expect(+ addProviderKey("openrouter", "not-a-real-key"),+ ).resolves.toBeUndefined();+ });++ it("accepts the empty successful delete response", async () => {+ await expect(removeProviderKey("openrouter")).resolves.toBeUndefined();+ });+});