fix: add response size in response pane

This commit is contained in:
Dipin Jagadish 2023-10-10 22:56:38 +01:00
parent 1979be6c4b
commit 32629cdcca

View File

@ -7,7 +7,7 @@ export const sendNetworkRequest = async (item, collection, environment, collecti
state: 'success', state: 'success',
data: response.data, data: response.data,
headers: Object.entries(response.headers), headers: Object.entries(response.headers),
size: response.headers['content-length'] || 0, size: getResponseSize(response),
status: response.status, status: response.status,
statusText: response.statusText, statusText: response.statusText,
duration: response.duration duration: response.duration
@ -29,6 +29,10 @@ const sendHttpRequest = async (item, collection, environment, collectionVariable
}); });
}; };
const getResponseSize = (response) => {
return response.headers['content-length'] || Buffer.byteLength(JSON.stringify(response.data)) || 0;
};
export const fetchGqlSchema = async (endpoint, environment, request, collection) => { export const fetchGqlSchema = async (endpoint, environment, request, collection) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const { ipcRenderer } = window; const { ipcRenderer } = window;