diff --git a/packages/bruno-electron/src/ipc/network/prepare-request.js b/packages/bruno-electron/src/ipc/network/prepare-request.js index f3aea2c8f..de6ed1632 100644 --- a/packages/bruno-electron/src/ipc/network/prepare-request.js +++ b/packages/bruno-electron/src/ipc/network/prepare-request.js @@ -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') {