fix: resolve diagnostic paths under the base path prefix and tolerate health-style ping responses
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user