Files
bowenliang123 f4db11776f fix(client): ride the fetch routes as browser-relative spellings
The client POSTed every plugin route as a root-absolute /api/dsh-context/*
path, which stripped a reverse proxy's /app/dsh prefix at the gateway —
every poll 404ed at it, the panel retried on an aggressive backoff, and
the deployment fell into the issue #159 reconnect loop. The six route
constants now live in one module as their browser-relative spellings:
fetch resolves them against the page's document base, the same idiom
dsh's own stream/socket clients ride, so a prefixed proxy keeps its
prefix and a direct deployment resolves to the exact same URLs before
and after. A host/client pairing spec pins each spelling to its route
registration, and docs/compatibility.md gains the §5.8 client-seam rule.

Fixes #159
2026-10-16 23:50:58 +08:00

19 lines
536 B
TypeScript

import assert from 'node:assert/strict'
import { describe, test } from 'vitest'
import {
ATTACHMENT_ROUTE,
BACKFILL_ROUTE,
BALANCE_ROUTE,
DETAIL_ROUTE,
FLEET_ROUTE,
SKILLS_ROUTE,
} from '../../src/client/apiRoutes'
describe('apiRoutes', () => {
test('every fetch route stays browser-relative under the plugin namespace', () => {
for (const route of [ATTACHMENT_ROUTE, BACKFILL_ROUTE, BALANCE_ROUTE, DETAIL_ROUTE, FLEET_ROUTE, SKILLS_ROUTE]) {
assert.match(route, /^api\/dsh-context\/\w+$/, route)
}
})
})