Newer
Older
percord / patches / body-parser+2.2.2.patch
@Rory& Rory& on 18 Apr 1 KB NPM updates 2
diff --git a/node_modules/body-parser/lib/types/json.js b/node_modules/body-parser/lib/types/json.js
index 23c7357..0243133 100644
--- a/node_modules/body-parser/lib/types/json.js
+++ b/node_modules/body-parser/lib/types/json.js
@@ -15,6 +15,7 @@
 var debug = require('debug')('body-parser:json')
 var read = require('../read')
 var { normalizeOptions } = require('../utils')
+var JSONbig = require("json-bigint");
 
 /**
  * Module exports.
@@ -69,7 +70,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,
@@ -106,7 +107,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(JSON_SYNTAX_REGEXP, function (placeholder) {
@@ -151,7 +152,7 @@ function normalizeJsonSyntaxError (error, obj) {
   }
 
   // replace stack before message for Node.js 0.10 and below
-  error.stack = obj.stack.replace(error.message, obj.message)
+  error.stack = obj.stack?.replace(error.message, obj.message)
   error.message = obj.message
 
   return error