summary refs log tree commit diff
path: root/patches/body-parser+1.20.1.patch
blob: 11d1a9d151528a117e04ea7fbe1664b8d418322f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
diff --git a/node_modules/body-parser/lib/types/json.js b/node_modules/body-parser/lib/types/json.js
index c2745be..17c2cfe 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),
@@ -216,7 +217,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