mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-07 14:08:38 +00:00
Merge branch 'main' of https://github.com/sthagen/usebruno-bruno into feature/export-to-postman-collection
This commit is contained in:
@@ -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';
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user