🐛 Replace jsonBigint with lossless-json (#2006)

This commit is contained in:
David Saunders 2024-04-09 21:45:44 +01:00 committed by GitHub
parent 484f6ef0c1
commit 920c490548
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 6 deletions

15
package-lock.json generated
View File

@ -19,7 +19,8 @@
"packages/bruno-graphql-docs"
],
"dependencies": {
"json-bigint": "^1.0.0"
"json-bigint": "^1.0.0",
"lossless-json": "^4.0.1"
},
"devDependencies": {
"@faker-js/faker": "^7.6.0",
@ -12471,6 +12472,11 @@
"loose-envify": "cli.js"
}
},
"node_modules/lossless-json": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/lossless-json/-/lossless-json-4.0.1.tgz",
"integrity": "sha512-l0L+ppmgPDnb+JGxNLndPtJZGNf6+ZmVaQzoxQm3u6TXmhdnsA+YtdVR8DjzZd/em58686CQhOFDPewfJ4l7MA=="
},
"node_modules/loupe": {
"version": "2.3.7",
"license": "MIT",
@ -19676,7 +19682,7 @@
},
"packages/bruno-electron": {
"name": "bruno",
"version": "v1.11.0",
"version": "v1.12.3",
"dependencies": {
"@aws-sdk/credential-providers": "3.525.0",
"@usebruno/common": "0.1.0",
@ -30815,6 +30821,11 @@
"js-tokens": "^3.0.0 || ^4.0.0"
}
},
"lossless-json": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/lossless-json/-/lossless-json-4.0.1.tgz",
"integrity": "sha512-l0L+ppmgPDnb+JGxNLndPtJZGNf6+ZmVaQzoxQm3u6TXmhdnsA+YtdVR8DjzZd/em58686CQhOFDPewfJ4l7MA=="
},
"loupe": {
"version": "2.3.7",
"requires": {

View File

@ -47,10 +47,12 @@
"test:prettier:web": "npm run test:prettier --workspace=packages/bruno-app",
"prepare": "husky install"
},
"overrides": {
"rollup": "3.2.5"
},
"dependencies": {
"json-bigint": "^1.0.0"
"json-bigint": "^1.0.0",
"lossless-json": "^4.0.1"
}
}

View File

@ -8,7 +8,7 @@ import { humanizeRequestBodyMode } from 'utils/collections';
import StyledWrapper from './StyledWrapper';
import { updateRequestBody } from 'providers/ReduxStore/slices/collections/index';
import { toastError } from 'utils/common/error';
import jsonBigint from 'json-bigint';
import { parse, stringify } from 'lossless-json';
const RequestBodyMode = ({ item, collection }) => {
const dispatch = useDispatch();
@ -38,8 +38,8 @@ const RequestBodyMode = ({ item, collection }) => {
const onPrettify = () => {
if (body?.json && bodyMode === 'json') {
try {
const bodyJson = jsonBigint.parse(body.json);
const prettyBodyJson = jsonBigint.stringify(bodyJson, null, 2);
const bodyJson = parse(body.json);
const prettyBodyJson = stringify(bodyJson, null, 2);
dispatch(
updateRequestBody({
content: prettyBodyJson,