Skip to content

Commit 3d2fddc

Browse files
Peter HaugeCopilot
andcommitted
fix: add supportsGet guard to getResource
Short-circuit getResource for resource types that don't support GET (e.g. ProductGroup, ProductApi, GatewayApi) before making a network call. This centralizes the guard and makes pollAsyncOperation safe for all resource types. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d6f89a9 commit 3d2fddc

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/clients/apim-client.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,14 @@ export class ApimClient implements IApimClient {
302302
context: ApimServiceContext,
303303
descriptor: ResourceDescriptor
304304
): Promise<Record<string, unknown> | undefined> {
305+
// Some association resources (ProductGroup, ProductApi, GatewayApi) only
306+
// support PUT/DELETE. Short-circuit before making a network call.
307+
const metadata = RESOURCE_TYPE_METADATA[descriptor.type];
308+
if (!metadata.supportsGet) {
309+
logger.debug(`Resource type ${descriptor.type} does not support GET, returning undefined`);
310+
return undefined;
311+
}
312+
305313
const url = buildArmUri(context, descriptor);
306314
// Azure APIM returns HTTP 500 (not 404) when an API or product has no wiki.
307315
// Suppress retries for wiki types so the extractor silently skips them.

0 commit comments

Comments
 (0)