mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-22 23:02:40 +01:00
Merge pull request #3586 from sanjaikumar-bruno/fix/multipart-file-with-same-key-name
fix: refactor createFormData function
This commit is contained in:
commit
09120a96e8
@ -2,7 +2,7 @@ const { get, each, filter } = require('lodash');
|
||||
const decomment = require('decomment');
|
||||
const crypto = require('node:crypto');
|
||||
const { getTreePathFromCollectionToItem, mergeHeaders, mergeScripts, mergeVars } = require('../../utils/collection');
|
||||
const { buildFormUrlEncodedPayload } = require('../../utils/form-data');
|
||||
const { buildFormUrlEncodedPayload, createFormData } = require('../../utils/form-data');
|
||||
|
||||
const setAuthHeaders = (axiosRequest, request, collectionRoot) => {
|
||||
const collectionAuth = get(collectionRoot, 'request.auth');
|
||||
@ -245,11 +245,11 @@ const prepareRequest = (item, collection) => {
|
||||
}
|
||||
|
||||
if (request.body.mode === 'multipartForm') {
|
||||
axiosRequest.headers['content-type'] = 'multipart/form-data';
|
||||
const params = {};
|
||||
if (!contentTypeDefined) {
|
||||
axiosRequest.headers['content-type'] = 'multipart/form-data';
|
||||
}
|
||||
const enabledParams = filter(request.body.multipartForm, (p) => p.enabled);
|
||||
each(enabledParams, (p) => (params[p.name] = p.value));
|
||||
axiosRequest.data = params;
|
||||
axiosRequest.data = createFormData(enabledParams);
|
||||
}
|
||||
|
||||
if (request.body.mode === 'graphql') {
|
||||
|
Loading…
Reference in New Issue
Block a user