Merge branch 'main' of https://github.com/sthagen/usebruno-bruno into feature/export-to-postman-collection

This commit is contained in:
Miroslav Kapa
2023-10-12 00:31:23 +02:00
14 changed files with 99 additions and 67 deletions

View File

@@ -60,6 +60,8 @@ export const getCodeMirrorModeBasedOnContentType = (contentType) => {
return 'application/xml';
} else if (contentType.includes('yaml')) {
return 'application/yaml';
} else if (contentType.includes('image')) {
return 'application/image';
} else {
return 'application/text';
}

View File

@@ -1,3 +1,5 @@
import { safeStringifyJSON } from 'utils/common';
export const sendNetworkRequest = async (item, collection, environment, collectionVariables) => {
return new Promise((resolve, reject) => {
if (['http-request', 'graphql-request'].includes(item.type)) {
@@ -7,7 +9,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 +31,10 @@ const sendHttpRequest = async (item, collection, environment, collectionVariable
});
};
const getResponseSize = (response) => {
return response.headers['content-length'] || Buffer.byteLength(safeStringifyJSON(response.data)) || 0;
};
export const fetchGqlSchema = async (endpoint, environment, request, collection) => {
return new Promise((resolve, reject) => {
const { ipcRenderer } = window;