Skip to content

Commit

Permalink
Fix/xml body not getting added during curl import. (#3547)
Browse files Browse the repository at this point in the history
* Add support for XML data handling in curl-to-json utility

* Refactor XML content type handling in curl utility
  • Loading branch information
sanjai0py authored Nov 30, 2024
1 parent 0a8217e commit b4ea101
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/bruno-app/src/utils/curl/curl-to-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
2 changes: 1 addition & 1 deletion packages/bruno-app/src/utils/curl/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down

0 comments on commit b4ea101

Please sign in to comment.