adding a real test Method for API gateway

This commit is contained in:
Zakaria
2026-09-27 20:14:59 -04:00
parent e8843a462b
commit ce8400757c
10 changed files with 321 additions and 23 deletions
@@ -263,6 +263,25 @@ export interface ApiGatewayTestRouteResult {
durationMs: number;
}
export interface TestApiGatewayMethodInput {
resourceId: string;
httpMethod: string;
pathWithQueryString: string;
body: string;
headers: Record<string, string>;
multiValueHeaders: Record<string, string[]>;
stageVariables: Record<string, string>;
}
export interface ApiGatewayMethodTestResult {
statusCode: number;
body: string;
headers: Record<string, string>;
multiValueHeaders: Record<string, string[]>;
log: string | null;
latency: number | null;
}
export interface ApiGatewayRouteOverview {
resourceId: string;
path: string;
@@ -445,6 +464,20 @@ export async function testApiGatewayRoute(
return res.data;
}
export async function testApiGatewayMethod(
cloud: CloudProvider,
apiId: string,
input: TestApiGatewayMethodInput,
signal?: AbortSignal,
): Promise<ApiGatewayMethodTestResult> {
const res = await apiClient.call<ApiGatewayMethodTestResult, TestApiGatewayMethodInput>(
apiEndpointKeys.clouds.resources.testApiGatewayMethod,
requestOptions(cloud, "apigateway", { signal, body: input, timeout: INVOKE_TIMEOUT_MS }),
{ cloud, id: apiId },
);
return res.data;
}
export async function createS3LambdaTrigger(
cloud: CloudProvider,
bucketName: string,