@@ -51,15 +51,15 @@ interface HarLog extends HarFormat.Log {
5151export  type  RequestContentData  =  { 
5252    text : string ; 
5353    size : number ; 
54-     encoding ? : 'base64' ; 
54+     encoding : 'base64' ; 
5555    comment ?: string ; 
5656} ; 
5757
5858export  interface  ExtendedHarRequest  extends  HarFormat . Request  { 
5959    _requestBodyStatus ?:
60-          |  'discarded:too-large' 
61-          |  'discarded:not-representable' 
62-          |  'discarded:not-decodable' ; 
60+     |  'discarded:too-large' 
61+     |  'discarded:not-representable'   // to indicate that extended field `_content` is populated with base64 `postData` 
62+     |  'discarded:not-decodable' ; 
6363    _content ?: RequestContentData ; 
6464    _trailers ?: HarFormat . Header [ ] ; 
6565} 
@@ -302,7 +302,7 @@ async function generateHarResponse(
302302
303303    const  decoded  =  await  response . body . decodedPromise ; 
304304
305-     let  responseContent : {  text : string ,  encoding ?: string  }  |  {  comment : string } ; 
305+     let  responseContent : {  text : string ,  encoding ?: string  }  |  {  comment : string   } ; 
306306    try  { 
307307        if  ( ! decoded  ||  decoded . byteLength  >  options . bodySizeLimit )  { 
308308            // If no body or the body is too large, don't include it 
@@ -435,10 +435,10 @@ function generateHarWebSocketMessage(
435435    return  { 
436436        // Note that msg.direction is from the perspective of Mockttp, not the client. 
437437        type : message . direction  ===  'sent' 
438-                  ? 'receive' 
438+             ? 'receive' 
439439            : message . direction  ===  'received' 
440440                ? 'send' 
441-             : unreachableCheck ( message . direction ) , 
441+                  : unreachableCheck ( message . direction ) , 
442442
443443        opcode : message . isBinary  ? 2  : 1 , 
444444        data : message . isBinary 
@@ -751,7 +751,7 @@ function parseHttpVersion(
751751} 
752752
753753function  parseHarRequestContents ( data : RequestContentData ) : Buffer  { 
754-     if  ( data . encoding   &&   Buffer . isEncoding ( data . encoding ) )  { 
754+     if  ( Buffer . isEncoding ( data . encoding ) )  { 
755755        return  Buffer . from ( data . text ,  data . encoding ) ; 
756756    } 
757757
0 commit comments