mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 07:53:34 +01:00
feat: response size
This commit is contained in:
parent
7a61f29acc
commit
fc32f5b413
@ -86,11 +86,15 @@ const RequestTabPanel = ({dispatch, actions, collections, activeRequestTabId, re
|
|||||||
console.log(headers);
|
console.log(headers);
|
||||||
|
|
||||||
if(data && !errors) {
|
if(data && !errors) {
|
||||||
|
// todo: alternate way to calculate length when content length is not present
|
||||||
|
const size = headers.map["content-length"];
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: actions.RESPONSE_RECEIVED,
|
type: actions.RESPONSE_RECEIVED,
|
||||||
response: {
|
response: {
|
||||||
data: data,
|
data: data,
|
||||||
headers: Object.entries(headers.map),
|
headers: Object.entries(headers.map),
|
||||||
|
size: size,
|
||||||
status: status,
|
status: status,
|
||||||
duration: timeEnd - timeStart
|
duration: timeEnd - timeStart
|
||||||
},
|
},
|
||||||
|
@ -1,10 +1,20 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
|
||||||
const ResponseSize = () => {
|
const ResponseSize = ({size}) => {
|
||||||
|
let sizeToDisplay = ''
|
||||||
|
|
||||||
|
if(size > 1024 ) { // size is greater than 1kb
|
||||||
|
let kb = Math.floor(size / 1024);
|
||||||
|
let decimal = ((size % 1024) / 1024).toFixed(2) * 100;
|
||||||
|
sizeToDisplay = kb + '.' + decimal + 'KB';
|
||||||
|
} else {
|
||||||
|
sizeToDisplay = size + 'B'
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledWrapper className="mt-3 ml-4">
|
<StyledWrapper className="mt-3 ml-4">
|
||||||
8.31KB
|
{sizeToDisplay}
|
||||||
</StyledWrapper>
|
</StyledWrapper>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
@ -50,7 +50,7 @@ const ResponsePane = ({rightPaneWidth, response, isLoading}) => {
|
|||||||
<div className="flex flex-grow justify-end items-center">
|
<div className="flex flex-grow justify-end items-center">
|
||||||
<StatusCode status={response.status}/>
|
<StatusCode status={response.status}/>
|
||||||
<ResponseTime duration={response.duration}/>
|
<ResponseTime duration={response.duration}/>
|
||||||
<ResponseSize />
|
<ResponseSize size={response.size}/>
|
||||||
</div>
|
</div>
|
||||||
) : null }
|
) : null }
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user