feat: correctly format json when importing from curl (#1472)

This commit is contained in:
Anton Ödman
2024-01-29 18:59:31 +01:00
committed by GitHub
parent d999366a16
commit 467e63d6fa
4 changed files with 83 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
import { forOwn } from 'lodash';
import { safeStringifyJSON } from 'utils/common';
import { convertToCodeMirrorJson } from 'utils/common';
import curlToJson from './curl-to-json';
export const getRequestFromCurlCommand = (curlCommand) => {
@@ -37,7 +37,7 @@ export const getRequestFromCurlCommand = (curlCommand) => {
if (parsedBody && contentType && typeof contentType === 'string') {
if (contentType.includes('application/json')) {
body.mode = 'json';
body.json = safeStringifyJSON(parsedBody);
body.json = convertToCodeMirrorJson(parsedBody);
} else if (contentType.includes('text/xml')) {
body.mode = 'xml';
body.xml = parsedBody;