mirror of
https://github.com/usebruno/bruno.git
synced 2025-08-20 12:52:06 +02:00
feat(#1130): file upload schema updates
This commit is contained in:
@@ -132,9 +132,11 @@ const mapPairListToKeyValPairsMultipart = (pairList = [], parseEnabled = true) =
|
||||
const pairs = mapPairListToKeyValPairs(pairList, parseEnabled);
|
||||
|
||||
return pairs.map((pair) => {
|
||||
pair.type = 'text';
|
||||
if (pair.value.startsWith('@file(') && pair.value.endsWith(')')) {
|
||||
pair.isFile = true;
|
||||
pair.value = pair.value.replace(/^@file\(/, '').replace(/\)$/, '');
|
||||
let filestr = pair.value.replace(/^@file\(/, '').replace(/\)$/, '');
|
||||
pair.type = 'file';
|
||||
pair.value = filestr.split('|');
|
||||
}
|
||||
return pair;
|
||||
});
|
||||
|
@@ -188,9 +188,17 @@ ${indentString(body.sparql)}
|
||||
multipartForms
|
||||
.map((item) => {
|
||||
const enabled = item.enabled ? '' : '~';
|
||||
const value = item.isFile ? `@file(${item.value})` : item.value;
|
||||
|
||||
return `${enabled}${item.name}: ${value}`;
|
||||
if (item.type === 'text') {
|
||||
return `${enabled}${item.name}: ${item.value}`;
|
||||
}
|
||||
|
||||
if (item.type === 'file') {
|
||||
let filepaths = item.value || [];
|
||||
let filestr = filepaths.join('|');
|
||||
const value = `@file(${filestr})`;
|
||||
return `${enabled}${item.name}: ${value}`;
|
||||
}
|
||||
})
|
||||
.join('\n')
|
||||
)}`;
|
||||
|
Reference in New Issue
Block a user