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> {
|
async body(): Promise<Buffer> {
|
||||||
try {
|
return await this._request._wrapApiCall(async () => {
|
||||||
const result = await this._request._channel.fetchResponseBody({ fetchUid: this._fetchUid() });
|
try {
|
||||||
if (result.binary === undefined)
|
const result = await this._request._channel.fetchResponseBody({ fetchUid: this._fetchUid() });
|
||||||
throw new Error('Response has been disposed');
|
if (result.binary === undefined)
|
||||||
return result.binary;
|
throw new Error('Response has been disposed');
|
||||||
} catch (e) {
|
return result.binary;
|
||||||
if (isTargetClosedError(e))
|
} catch (e) {
|
||||||
throw new Error('Response has been disposed');
|
if (isTargetClosedError(e))
|
||||||
throw e;
|
throw new Error('Response has been disposed');
|
||||||
}
|
throw e;
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async text(): Promise<string> {
|
async text(): Promise<string> {
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,7 @@ const playwrightFixtures: Fixtures<TestFixtures, WorkerFixtures> = ({
|
||||||
onApiCallBegin: (data: ApiCallData) => {
|
onApiCallBegin: (data: ApiCallData) => {
|
||||||
const testInfo = currentTestInfo();
|
const testInfo = currentTestInfo();
|
||||||
// Some special calls do not get into steps.
|
// 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;
|
return;
|
||||||
const zone = currentZone().data<TestStepInternal>('stepZone');
|
const zone = currentZone().data<TestStepInternal>('stepZone');
|
||||||
if (zone && zone.category === 'expect') {
|
if (zone && zone.category === 'expect') {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue