diff --git a/src/test/api/api-formdata-content-type.test.ts b/src/test/api/api-formdata-content-type.test.ts index 2db34987..b914b9f0 100644 --- a/src/test/api/api-formdata-content-type.test.ts +++ b/src/test/api/api-formdata-content-type.test.ts @@ -49,10 +49,12 @@ describe("api.post FormData Content-Type", () => { expect(capturedContentType).not.toBe("application/json"); // Browser sets multipart/form-data; boundary=... when Content-Type was stripped. - // In jsdom/fetch mock the runtime may leave it null or set multipart — both are OK + // In jsdom/fetch mock the runtime may leave it null or set multipart - both are OK // as long as it is not forced JSON. - if (capturedContentType) { - expect(capturedContentType.toLowerCase()).toContain("multipart/form-data"); + // Cast after expect(): Vitest assertion narrowing collapses string|null to never. + const contentType = capturedContentType as string | null; + if (contentType !== null) { + expect(contentType.toLowerCase()).toContain("multipart/form-data"); } }); });