mirror of
https://github.com/usebruno/bruno.git
synced 2025-02-13 08:19:57 +01:00
Added more logic for raw file and added rawFile to validation list so it can be saved.
This commit is contained in:
parent
060237302f
commit
b792f490cb
@ -843,6 +843,10 @@ export const collectionsSlice = createSlice({
|
||||
item.draft.request.body.multipartForm = action.payload.content;
|
||||
break;
|
||||
}
|
||||
case 'rawFile': {
|
||||
item.draft.request.body.rawFile = action.payload.content;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +294,8 @@ export const transformCollectionToSaveToExportAsFile = (collection, options = {}
|
||||
graphql: si.request.body.graphql,
|
||||
sparql: si.request.body.sparql,
|
||||
formUrlEncoded: copyFormUrlEncodedParams(si.request.body.formUrlEncoded),
|
||||
multipartForm: copyMultipartFormParams(si.request.body.multipartForm)
|
||||
multipartForm: copyMultipartFormParams(si.request.body.multipartForm),
|
||||
rawFile: si.request.body.rawFile
|
||||
},
|
||||
script: si.request.script,
|
||||
vars: si.request.vars,
|
||||
|
@ -381,6 +381,16 @@ const prepareRequest = (item, collection) => {
|
||||
axiosRequest.data = form;
|
||||
}
|
||||
|
||||
if(request.body.mode === 'rawFile') {
|
||||
if (request.body.rawFile && request.body.rawFile.value) {
|
||||
axiosRequest.data = fs.readFileSync(request.body.rawFile.value);
|
||||
fileLength = axiosRequest.data.length;
|
||||
axiosRequest.headers['content-length'] = fileLength;
|
||||
} else {
|
||||
axiosRequest.data = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (request.body.mode === 'graphql') {
|
||||
const graphqlQuery = {
|
||||
query: get(request, 'body.graphql.query'),
|
||||
|
@ -75,7 +75,7 @@ const multipartFormSchema = Yup.object({
|
||||
|
||||
const requestBodySchema = Yup.object({
|
||||
mode: Yup.string()
|
||||
.oneOf(['none', 'json', 'text', 'xml', 'formUrlEncoded', 'multipartForm', 'graphql', 'sparql'])
|
||||
.oneOf(['none', 'json', 'text', 'xml', 'formUrlEncoded', 'multipartForm', 'graphql', 'sparql', 'rawFile'])
|
||||
.required('mode is required'),
|
||||
json: Yup.string().nullable(),
|
||||
text: Yup.string().nullable(),
|
||||
|
Loading…
Reference in New Issue
Block a user