Skip to content

Commit 0230dfa

Browse files
committed
Filter out client error events from HAR exports
1 parent b9d70a3 commit 0230dfa

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/model/http/har.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,16 @@ export async function generateHar(
106106
events: readonly ViewableEvent[],
107107
options: HarGenerationOptions = { bodySizeLimit: HAR_BODY_SIZE_LIMIT }
108108
): Promise<Har> {
109-
const [exchanges, otherEvents] = _.partition(events, e => e.isHttp()) as [
109+
const [allExchanges, otherEvents] = _.partition(events, e => e.isHttp()) as [
110110
HttpExchangeView[], CollectedEvent[]
111111
];
112112

113+
// Filter out exchanges with client errors (fundamental request parsing failures) -
114+
// these contain best-guess data that may not be valid in a HAR:
115+
const exchanges = allExchanges.filter(e =>
116+
!e.tags.some(tag => tag.startsWith('client-error:'))
117+
);
118+
113119
const errors = otherEvents.filter(e => e.isTlsFailure()) as FailedTlsConnection[];
114120

115121
const sourcePages = getSourcesAsHarPages(exchanges);

0 commit comments

Comments
 (0)