@@ -100,15 +100,16 @@ const CompressionDescription = observer((p: {
100100} ) => {
101101 const { encodings, encodedBodyLength, decodedBodyLength } = p ;
102102
103- const compressionRatio = decodedBodyLength ? Math . round ( 100 * (
104- 1 - ( encodedBodyLength / decodedBodyLength )
105- ) ) : undefined ;
103+ const compressionRatio = decodedBodyLength
104+ ? Math . round ( 100 * ( 1 - ( encodedBodyLength / decodedBodyLength ) ) )
105+ : undefined ;
106106
107107 return < >
108108 { encodings . length ? < >
109109 compressed with < strong > { joinAnd ( encodings , ', ' , ' and then ' ) } </ strong > ,
110110 making it {
111- compressionRatio !== undefined && decodedBodyLength ? < >
111+ compressionRatio !== undefined && decodedBodyLength
112+ ? < >
112113 < strong >
113114 { compressionRatio >= 0 ?
114115 `${ compressionRatio } % smaller`
@@ -120,7 +121,8 @@ const CompressionDescription = observer((p: {
120121 } to {
121122 getReadableSize ( encodedBodyLength )
122123 } )
123- </ > : < Icon icon = { [ 'fas' , 'spinner' ] } spin />
124+ </ >
125+ : < Icon icon = { [ 'fas' , 'spinner' ] } spin />
124126 }
125127 </ > :
126128 < strong > not compressed</ strong >
@@ -213,10 +215,15 @@ const CompressionPerformance = observer((p: { exchange: HttpExchange }) => {
213215
214216 return < > { messageTypes . map ( ( messageType ) => {
215217 const message = p . exchange [ messageType ] ;
216- const encodings = getEncodings ( message ) ;
217218
218- if ( typeof message !== 'object' || ! message . body . encodedByteLength ) return null ;
219+ if (
220+ typeof message !== 'object' ||
221+ ! message ?. body ||
222+ ! message . body . encodedByteLength ||
223+ message . body . isFailed ( )
224+ ) return null ;
219225
226+ const encodings = getEncodings ( message ) ;
220227 const encodedBodySize = message . body . encodedByteLength ;
221228 const decodedBody = message . body . decodedData ;
222229 const decodedBodySize = decodedBody ? decodedBody . byteLength : 0 ;
0 commit comments