mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-07 16:44:27 +01:00
Fix/json with bigints (#1710)
* fix(#1689): JSON with Bigints support * added Jsonbigint support for cli
This commit is contained in:
parent
cc02794ce9
commit
e2d1f52993
18024
package-lock.json
generated
18024
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -49,5 +49,8 @@
|
|||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"rollup": "3.2.5"
|
"rollup": "3.2.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"json-bigint": "^1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import { humanizeRequestBodyMode } from 'utils/collections';
|
|||||||
import StyledWrapper from './StyledWrapper';
|
import StyledWrapper from './StyledWrapper';
|
||||||
import { updateRequestBody } from 'providers/ReduxStore/slices/collections/index';
|
import { updateRequestBody } from 'providers/ReduxStore/slices/collections/index';
|
||||||
import { toastError } from 'utils/common/error';
|
import { toastError } from 'utils/common/error';
|
||||||
|
import jsonBigint from 'json-bigint';
|
||||||
|
|
||||||
const RequestBodyMode = ({ item, collection }) => {
|
const RequestBodyMode = ({ item, collection }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@ -37,8 +38,8 @@ const RequestBodyMode = ({ item, collection }) => {
|
|||||||
const onPrettify = () => {
|
const onPrettify = () => {
|
||||||
if (body?.json && bodyMode === 'json') {
|
if (body?.json && bodyMode === 'json') {
|
||||||
try {
|
try {
|
||||||
const bodyJson = JSON.parse(body.json);
|
const bodyJson = jsonBigint.parse(body.json);
|
||||||
const prettyBodyJson = JSON.stringify(bodyJson, null, 2);
|
const prettyBodyJson = jsonBigint.stringify(bodyJson, null, 2);
|
||||||
dispatch(
|
dispatch(
|
||||||
updateRequestBody({
|
updateRequestBody({
|
||||||
content: prettyBodyJson,
|
content: prettyBodyJson,
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
"http-proxy-agent": "^7.0.0",
|
"http-proxy-agent": "^7.0.0",
|
||||||
"https-proxy-agent": "^7.0.2",
|
"https-proxy-agent": "^7.0.2",
|
||||||
"inquirer": "^9.1.4",
|
"inquirer": "^9.1.4",
|
||||||
|
"json-bigint": "^1.0.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mustache": "^4.2.0",
|
"mustache": "^4.2.0",
|
||||||
"qs": "^6.11.0",
|
"qs": "^6.11.0",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const { get, each, filter } = require('lodash');
|
const { get, each, filter } = require('lodash');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
var JSONbig = require('json-bigint');
|
||||||
const decomment = require('decomment');
|
const decomment = require('decomment');
|
||||||
|
|
||||||
const prepareRequest = (request, collectionRoot) => {
|
const prepareRequest = (request, collectionRoot) => {
|
||||||
@ -87,7 +88,7 @@ const prepareRequest = (request, collectionRoot) => {
|
|||||||
axiosRequest.headers['content-type'] = 'application/json';
|
axiosRequest.headers['content-type'] = 'application/json';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
axiosRequest.data = JSON.parse(decomment(request.body.json));
|
axiosRequest.data = JSONbig.parse(decomment(request.body.json));
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
axiosRequest.data = request.body.json;
|
axiosRequest.data = request.body.json;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
"https-proxy-agent": "^7.0.2",
|
"https-proxy-agent": "^7.0.2",
|
||||||
"is-valid-path": "^0.1.1",
|
"is-valid-path": "^0.1.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
|
"json-bigint": "^1.0.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "^2.1.35",
|
||||||
"mustache": "^4.2.0",
|
"mustache": "^4.2.0",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const { get, each, filter, extend } = require('lodash');
|
const { get, each, filter, extend } = require('lodash');
|
||||||
const decomment = require('decomment');
|
const decomment = require('decomment');
|
||||||
|
var JSONbig = require('json-bigint');
|
||||||
const FormData = require('form-data');
|
const FormData = require('form-data');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
@ -179,8 +180,7 @@ const prepareRequest = (request, collectionRoot, collectionPath) => {
|
|||||||
axiosRequest.headers['content-type'] = 'application/json';
|
axiosRequest.headers['content-type'] = 'application/json';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// axiosRequest.data = JSON.parse(request.body.json);
|
axiosRequest.data = JSONbig.parse(decomment(request.body.json));
|
||||||
axiosRequest.data = JSON.parse(decomment(request.body.json));
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
axiosRequest.data = request.body.json;
|
axiosRequest.data = request.body.json;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user