use wrapApiCall
This commit is contained in:
parent
8ab12c0779
commit
b864458988
|
|
@ -338,16 +338,18 @@ export class APIResponse implements api.APIResponse {
|
|||
}
|
||||
|
||||
async body(): Promise<Buffer> {
|
||||
try {
|
||||
const result = await this._request._channel.fetchResponseBody({ fetchUid: this._fetchUid() });
|
||||
if (result.binary === undefined)
|
||||
throw new Error('Response has been disposed');
|
||||
return result.binary;
|
||||
} catch (e) {
|
||||
if (isTargetClosedError(e))
|
||||
throw new Error('Response has been disposed');
|
||||
throw e;
|
||||
}
|
||||
return await this._request._wrapApiCall(async () => {
|
||||
try {
|
||||
const result = await this._request._channel.fetchResponseBody({ fetchUid: this._fetchUid() });
|
||||
if (result.binary === undefined)
|
||||
throw new Error('Response has been disposed');
|
||||
return result.binary;
|
||||
} catch (e) {
|
||||
if (isTargetClosedError(e))
|
||||
throw new Error('Response has been disposed');
|
||||
throw e;
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
async text(): Promise<string> {
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
|
|||
onApiCallBegin: (data: ApiCallData) => {
|
||||
const testInfo = currentTestInfo();
|
||||
// Some special calls do not get into steps.
|
||||
if (!testInfo || data.apiName.includes('setTestIdAttribute') || data.apiName === 'tracing.groupEnd' || data.apiName.startsWith('apiResponse.'))
|
||||
if (!testInfo || data.apiName.includes('setTestIdAttribute') || data.apiName === 'tracing.groupEnd')
|
||||
return;
|
||||
const zone = currentZone().data<TestStepInternal>('stepZone');
|
||||
if (zone && zone.category === 'expect') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue