@@ -32,6 +32,9 @@ export interface Har extends HarFormat.Har {
3232interface HarLog extends HarFormat . Log {
3333 // Custom field to expose failed TLS connections
3434 _tlsErrors : HarTlsErrorEntry [ ] ;
35+
36+ // Our extended version of HAR entries:
37+ entries : HarEntry [ ] ;
3538}
3639
3740export type RequestContentData = {
@@ -49,7 +52,10 @@ export interface ExtendedHarRequest extends HarFormat.Request {
4952 _content ?: RequestContentData ;
5053}
5154
52- export type HarEntry = HarFormat . Entry ;
55+ export interface HarEntry extends HarFormat . Entry {
56+ _pinned ?: true ;
57+ }
58+
5359export type HarTlsErrorEntry = {
5460 startedDateTime : string ;
5561 time : number ; // Floating-point high-resolution duration, in ms
@@ -345,7 +351,8 @@ async function generateHarEntry(exchange: HttpExchange): Promise<HarEntry> {
345351 send : Math . max ( sendDuration , 0 ) ,
346352 wait : Math . max ( waitDuration , 0 ) ,
347353 receive : Math . max ( receiveDuration , 0 )
348- }
354+ } ,
355+ _pinned : exchange . pinned || undefined
349356 } ;
350357}
351358
@@ -375,6 +382,7 @@ export type ParsedHar = {
375382 responses : HarResponse [ ] ,
376383 aborts : HarRequest [ ] ,
377384 tlsErrors : InputTLSRequest [ ]
385+ pinnedIds : string [ ]
378386} ;
379387
380388const sumTimings = (
@@ -396,6 +404,7 @@ export async function parseHar(harContents: unknown): Promise<ParsedHar> {
396404 const responses : HarResponse [ ] = [ ] ;
397405 const aborts : HarRequest [ ] = [ ] ;
398406 const tlsErrors : InputTLSRequest [ ] = [ ] ;
407+ const pinnedIds : string [ ] = [ ]
399408
400409 har . log . entries . forEach ( ( entry , i ) => {
401410 const id = baseId + i ;
@@ -429,6 +438,8 @@ export async function parseHar(harContents: unknown): Promise<ParsedHar> {
429438 } else {
430439 aborts . push ( request ) ;
431440 }
441+
442+ if ( entry . _pinned ) pinnedIds . push ( id ) ;
432443 } ) ;
433444
434445 if ( har . log . _tlsErrors ) {
@@ -448,7 +459,7 @@ export async function parseHar(harContents: unknown): Promise<ParsedHar> {
448459 } ) ;
449460 }
450461
451- return { requests, responses, aborts, tlsErrors } ;
462+ return { requests, responses, aborts, tlsErrors, pinnedIds } ;
452463}
453464
454465// Mutatively cleans & returns the HAR, to tidy up irrelevant but potentially
0 commit comments