fix: resolve diagnostic paths under the base path prefix and tolerate health-style ping responses

This commit is contained in:
2026-08-13 20:58:10 +02:00
parent 3a3efc3285
commit 9d7e9a05b7
3 changed files with 22 additions and 4 deletions
+10 -2
View File
@@ -236,8 +236,16 @@ export function createConcreteDiagnosticAdapters(
if ("response" in request.diagnostic) {
const payload = await response.json().catch(() => undefined) as Record<string, unknown> | undefined;
const declared = request.diagnostic.response;
if (!payload || (declared?.database && payload[declared.database] !== request.resource.database)
|| (declared?.schema && payload[declared.schema] !== request.resource.schema)) {
// Validate a declared field only when the probe response actually carries it, so a
// health-style ping (2xx + JSON without database/schema identity) still proves a
// reachable, authenticated connector. Declared fields that are present must match.
const databaseMatches = declared?.database === undefined
|| payload?.[declared.database] === undefined
|| payload[declared.database] === request.resource.database;
const schemaMatches = declared?.schema === undefined
|| payload?.[declared.schema] === undefined
|| payload[declared.schema] === request.resource.schema;
if (!payload || !databaseMatches || !schemaMatches) {
throw new Error("REST probe failed");
}
}