mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-09 06:55:03 +00:00
feat(#1130): file upload schema updates
This commit is contained in:
@@ -256,6 +256,7 @@ export const transformCollectionToSaveToExportAsFile = (collection, options = {}
|
||||
return map(params, (param) => {
|
||||
return {
|
||||
uid: param.uid,
|
||||
type: param.type,
|
||||
name: param.name,
|
||||
value: param.value,
|
||||
description: param.description,
|
||||
@@ -520,10 +521,6 @@ export const refreshUidsInItem = (item) => {
|
||||
return item;
|
||||
};
|
||||
|
||||
export const isLocalCollection = (collection) => {
|
||||
return collection.pathname ? true : false;
|
||||
};
|
||||
|
||||
export const deleteUidsInItem = (item) => {
|
||||
delete item.uid;
|
||||
const params = get(item, 'request.params', []);
|
||||
|
||||
@@ -11,10 +11,6 @@ export const isElectron = () => {
|
||||
return window.ipcRenderer ? true : false;
|
||||
};
|
||||
|
||||
export const isLocalCollection = (collection) => {
|
||||
return collection.pathname ? true : false;
|
||||
};
|
||||
|
||||
export const resolveRequestFilename = (name) => {
|
||||
return `${trim(name)}.bru`;
|
||||
};
|
||||
|
||||
@@ -71,6 +71,18 @@ export const transformItemsInCollection = (collection) => {
|
||||
}
|
||||
|
||||
delete item.request.query;
|
||||
|
||||
// from 5 feb 2024, multipartFormData needs to have a type
|
||||
// this was introduced when we added support for file uploads
|
||||
// below logic is to make older collection exports backward compatible
|
||||
let multipartFormData = _.get(item, 'request.body.multipartForm');
|
||||
if (multipartFormData) {
|
||||
_.each(multipartFormData, (form) => {
|
||||
if (!form.type) {
|
||||
form.type = 'text';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (item.items && item.items.length) {
|
||||
|
||||
@@ -152,6 +152,7 @@ const transformInsomniaRequestItem = (request, index, allRequests) => {
|
||||
each(request.body.params, (param) => {
|
||||
brunoRequestItem.request.body.multipartForm.push({
|
||||
uid: uuid(),
|
||||
type: 'text',
|
||||
name: param.name,
|
||||
value: param.value,
|
||||
description: param.description,
|
||||
|
||||
@@ -168,6 +168,7 @@ const transformOpenapiRequestItem = (request) => {
|
||||
each(bodySchema.properties || {}, (prop, name) => {
|
||||
brunoRequestItem.request.body.multipartForm.push({
|
||||
uid: uuid(),
|
||||
type: 'text',
|
||||
name: name,
|
||||
value: '',
|
||||
description: prop.description || '',
|
||||
|
||||
@@ -144,8 +144,9 @@ const importPostmanV2CollectionItem = (brunoParent, item, parentAuth) => {
|
||||
if (bodyMode === 'formdata') {
|
||||
brunoRequestItem.request.body.mode = 'multipartForm';
|
||||
each(i.request.body.formdata, (param) => {
|
||||
brunoRequestItem.request.body.formUrlEncoded.push({
|
||||
brunoRequestItem.request.body.multipartForm.push({
|
||||
uid: uuid(),
|
||||
type: 'text',
|
||||
name: param.key,
|
||||
value: param.value,
|
||||
description: param.description,
|
||||
|
||||
Reference in New Issue
Block a user