Chrome DevTools for coding agents
fix: indicate when request and response bodies are not available (#446)
Alex Rudenko7d47d6b2f40b
diff --git a/src/formatters/networkFormatter.ts b/src/formatters/networkFormatter.tsindex b3466e8c..0d8189ba 100644--- a/src/formatters/networkFormatter.ts+++ b/src/formatters/networkFormatter.ts@@ -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>`;}}@@ -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>`;}}diff --git a/tests/formatters/networkFormatter.test.ts b/tests/formatters/networkFormatter.test.tsindex e9608f50..e22b0140 100644--- a/tests/formatters/networkFormatter.test.ts+++ b/tests/formatters/networkFormatter.test.ts@@ -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,});@@ -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,@@ -173,7 +173,7 @@ describe('networkFormatter', () => {const result = await getFormattedRequestBody(request, 200);- assert.strictEqual(result, undefined);+ assert.strictEqual(result, '<not available anymore>');});});@@ -232,7 +232,7 @@ describe('networkFormatter', () => {const result = await getFormattedResponseBody(response, 200);- assert.strictEqual(result, undefined);+ assert.strictEqual(result, '<not available anymore>');});});});