Skip to content

Commit 9364db4

Browse files
committed
Include a comment when response body is discarded in a HAR export
1 parent 536f25a commit 9364db4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/model/http/har.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,15 @@ async function generateHarResponse(
271271

272272
const decoded = await response.body.decodedPromise;
273273

274-
let responseContent: { text: string, encoding?: string } | {};
274+
let responseContent: { text: string, encoding?: string } | { comment: string};
275275
try {
276276
if (!decoded || decoded.byteLength > options.bodySizeLimit) {
277277
// If no body or the body is too large, don't include it
278-
responseContent = {};
278+
responseContent = {
279+
comment: `Body discarded during HAR generation: longer than limit of ${
280+
options.bodySizeLimit
281+
} bytes`
282+
};
279283
} else {
280284
// If body decodes as text, keep it as text
281285
responseContent = { text: UTF8Decoder.decode(decoded) };

0 commit comments

Comments
 (0)