Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/formatters/networkFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ export async function getFormattedResponseBody(

return `<binary data>`;
} catch {
// buffer() call might fail with CDP exception, in this case we don't print anything in the context
return;
return `<not available anymore>`;
}
}

Expand All @@ -91,8 +90,7 @@ export async function getFormattedRequestBody(
return `${getSizeLimitedString(fetchData, sizeLimit)}`;
}
} catch {
// fetchPostData() call might fail with CDP exception, in this case we don't print anything in the context
return;
return `<not available anymore>`;
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/formatters/networkFormatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe('networkFormatter', () => {

assert.strictEqual(result, 'test');
});
it('shows empty string when no postData available', async () => {
it('shows not available when no postData available', async () => {
const request = getMockRequest({
hasPostData: false,
});
Expand Down Expand Up @@ -164,7 +164,7 @@ describe('networkFormatter', () => {

assert.strictEqual(result, 'some text that is lo... <truncated>');
});
it('shows nothing on exception', async () => {
it('shows not available on exception', async () => {
const request = getMockRequest({
hasPostData: true,
postData: undefined,
Expand All @@ -173,7 +173,7 @@ describe('networkFormatter', () => {

const result = await getFormattedRequestBody(request, 200);

assert.strictEqual(result, undefined);
assert.strictEqual(result, '<not available anymore>');
});
});

Expand Down Expand Up @@ -232,7 +232,7 @@ describe('networkFormatter', () => {

const result = await getFormattedResponseBody(response, 200);

assert.strictEqual(result, undefined);
assert.strictEqual(result, '<not available anymore>');
});
});
});