Skip to content

Commit

Permalink
Fix: Handled the case where multipart content type is not sent as par…
Browse files Browse the repository at this point in the history
…t of form data
  • Loading branch information
Ashokkumar1798 committed Apr 22, 2024
1 parent 316682b commit 5b2b161
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/components/RestImport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ export default function RestImport({ language, restImportConfig }: { language: s
multipartParams.forEach((data, index) => {
if (data.name && data.value) {
if (data.type === 'file') {
formDataOject.append(data.name, new Blob([data.value], { type: 'application/json' }))
formDataOject.append(data.name, new Blob([data.value], { type: 'application/json' }), data.filename)
multiParamInfoList.push({ name: data.name, type: 'file', list: true, contentType: undefined, testValue: undefined })
} else {
formDataOject.append(data.name, data.contentType === 'text' ? data.value : new Blob([data.value], { type: data.contentType }))
Expand All @@ -763,6 +763,7 @@ export default function RestImport({ language, restImportConfig }: { language: s
setmultipartParams([...multipartParams, { name: '', value: '', type: 'file', contentType: 'file' }])
})
jsonObject['multiParamInfoList'] = multiParamInfoList
jsonObject['headers']['Content-Type'] = contentType
}
const blob = new Blob([JSON.stringify(jsonObject)], { type: 'application/json' });
formDataOject.append('wm_httpRequestDetails', blob)
Expand Down

0 comments on commit 5b2b161

Please sign in to comment.