remove /api support

This commit is contained in:
2026-07-31 14:19:48 +08:00
parent 46c69607c5
commit 6330b99860
11 changed files with 75 additions and 67 deletions
+11 -2
View File
@@ -15,7 +15,7 @@ let licensePrivateKey;
let licensePublicKeyPath;
async function post(payload) {
const response = await fetch(`${baseUrl}/api`, {
const response = await fetch(baseUrl, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(payload)
@@ -59,7 +59,7 @@ test("health endpoint reports ready", async () => {
assert.deepEqual(await response.json(), { success: true, service: "reinloop-server" });
});
test("root endpoint accepts API requests without the /api suffix", async () => {
test("root endpoint accepts API requests", async () => {
const response = await fetch(baseUrl, {
method: "POST",
headers: { "content-type": "application/json" },
@@ -69,6 +69,15 @@ test("root endpoint accepts API requests without the /api suffix", async () => {
assert.deepEqual(await response.json(), { success: true, companies: [] });
});
test("legacy /api endpoint is unavailable", async () => {
const response = await fetch(`${baseUrl}/api`, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ type: "listOrganizations", adminToken: "test-token" })
});
assert.equal(response.status, 404);
});
test("legacy data_record endpoint and uploadUserInfo type are unavailable", async () => {
const legacyRoute = await fetch(`${baseUrl}/data_record`, {
method: "POST",