Fix/xml body not getting added during curl import. (#3547)

* Add support for XML data handling in curl-to-json utility

* Refactor XML content type handling in curl utility
This commit is contained in:
Sanjai Kumar
2024-11-30 19:23:39 +05:30
committed by GitHub
parent 0a8217e4ab
commit b4ea101350
2 changed files with 3 additions and 1 deletions

View File

@@ -57,6 +57,8 @@ function getDataString(request) {
console.error('Failed to parse JSON data:', error);
return { data: request.data.toString() };
}
} else if (contentType && contentType.includes('application/xml')) {
return { data: request.data };
}
const parsedQueryString = querystring.parse(request.data, { sort: false });

View File

@@ -60,7 +60,7 @@ export const getRequestFromCurlCommand = (curlCommand, requestType = 'http-reque
} else if (contentType.includes('application/json')) {
body.mode = 'json';
body.json = convertToCodeMirrorJson(parsedBody);
} else if (contentType.includes('text/xml')) {
} else if (contentType.includes('xml')) {
body.mode = 'xml';
body.xml = parsedBody;
} else if (contentType.includes('application/x-www-form-urlencoded')) {