fix: multipart/form-data body interpolation (#3142)

* feat: updates

* feat: updates

* feat: updates

* feat: updates
This commit is contained in:
lohit
2024-09-23 15:54:54 +05:30
committed by GitHub
parent eb33504f19
commit ed20eccc25
13 changed files with 165 additions and 47 deletions

View File

@@ -120,16 +120,10 @@ const prepareRequest = (request, collectionRoot) => {
}
if (request.body.mode === 'multipartForm') {
axiosRequest.headers['content-type'] = 'multipart/form-data';
const params = {};
const enabledParams = filter(request.body.multipartForm, (p) => p.enabled);
each(enabledParams, (p) => {
if (p.type === 'file') {
params[p.name] = p.value.map((path) => fs.createReadStream(path));
} else {
params[p.name] = p.value;
}
});
axiosRequest.headers['content-type'] = 'multipart/form-data';
each(enabledParams, (p) => (params[p.name] = p.value));
axiosRequest.data = params;
}