lotr-sut/tests/api/support/api-utils.ts
Fellowship Scholar f6a5823439 init commit
2026-03-29 20:07:56 +00:00

19 lines
451 B
TypeScript

import { APIResponse } from '@playwright/test';
import { ApiTestState } from './fixtures';
/**
* Stores a response and its parsed body/status into apiState.
*/
export async function storeResponse(
response: APIResponse,
apiState: ApiTestState
): Promise<void> {
apiState.lastResponse = response;
apiState.lastStatus = response.status();
try {
apiState.lastBody = await response.json();
} catch {
apiState.lastBody = null;
}
}