Patch body-parser to use json-bigint
This commit is contained in:
parent
a1c07173bb
commit
402f358751
BIN
package-lock.json
generated
BIN
package-lock.json
generated
Binary file not shown.
@ -62,7 +62,7 @@
|
||||
"ajv-formats": "2.1.1",
|
||||
"amqplib": "^0.10.3",
|
||||
"bcrypt": "^5.0.1",
|
||||
"body-parser": "^1.20.1",
|
||||
"body-parser": "1.20.1",
|
||||
"cheerio": "^1.0.0-rc.12",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"dotenv": "^16.0.2",
|
||||
|
||||
30
patches/body-parser+1.20.1.patch
Normal file
30
patches/body-parser+1.20.1.patch
Normal file
@ -0,0 +1,30 @@
|
||||
diff --git a/node_modules/body-parser/lib/types/json.js b/node_modules/body-parser/lib/types/json.js
|
||||
index c2745be..7104cfa 100644
|
||||
--- a/node_modules/body-parser/lib/types/json.js
|
||||
+++ b/node_modules/body-parser/lib/types/json.js
|
||||
@@ -18,6 +18,7 @@ var createError = require('http-errors')
|
||||
var debug = require('debug')('body-parser:json')
|
||||
var read = require('../read')
|
||||
var typeis = require('type-is')
|
||||
+var JSONbig = require("json-bigint");
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
@@ -86,7 +87,7 @@ function json (options) {
|
||||
|
||||
try {
|
||||
debug('parse json')
|
||||
- return JSON.parse(body, reviver)
|
||||
+ return JSONbig.parse(body, reviver)
|
||||
} catch (e) {
|
||||
throw normalizeJsonSyntaxError(e, {
|
||||
message: e.message,
|
||||
@@ -157,7 +158,7 @@ function createStrictSyntaxError (str, char) {
|
||||
: ''
|
||||
|
||||
try {
|
||||
- JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
||||
+ JSONbig.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
||||
} catch (e) {
|
||||
return normalizeJsonSyntaxError(e, {
|
||||
message: e.message.replace('#', char),
|
||||
Reference in New Issue
Block a user