fix: plain text curl data

This commit is contained in:
Pooja Belaramani 2024-12-18 16:20:44 +05:30
parent b9ec0acab4
commit 5155ac1ed2

View File

@ -57,7 +57,7 @@ function getDataString(request) {
console.error('Failed to parse JSON data:', error); console.error('Failed to parse JSON data:', error);
return { data: request.data.toString() }; return { data: request.data.toString() };
} }
} else if (contentType && contentType.includes('application/xml')) { } else if (contentType && (contentType.includes('application/xml') || contentType.includes('text/plain'))) {
return { data: request.data }; return { data: request.data };
} }
@ -174,14 +174,14 @@ const curlToJson = (curlCommand) => {
} }
if (request.auth) { if (request.auth) {
if(request.auth.mode === 'basic'){ if (request.auth.mode === 'basic') {
requestJson.auth = { requestJson.auth = {
mode: 'basic', mode: 'basic',
basic: { basic: {
username: repr(request.auth.basic?.username), username: repr(request.auth.basic?.username),
password: repr(request.auth.basic?.password) password: repr(request.auth.basic?.password)
} }
} };
} }
} }