Merge pull request #520 from snippetkid/497-show-response-size

Show response size even if content-length header isn't present
This commit is contained in:
Anoop M D 2023-10-11 03:38:13 +05:30 committed by GitHub
commit de223acb19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,7 @@ export const sendNetworkRequest = async (item, collection, environment, collecti
state: 'success',
data: response.data,
headers: Object.entries(response.headers),
size: response.headers['content-length'] || 0,
size: getResponseSize(response),
status: response.status,
statusText: response.statusText,
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) => {
return new Promise((resolve, reject) => {
const { ipcRenderer } = window;