Skip to content

Commit b4c3c52

Browse files
sdellyssePhillip9587
authored andcommitted
fixed tests after rebase
1 parent 07def41 commit b4c3c52

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

lib/types/json.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,18 @@ function json(options) {
6969
return {}
7070
}
7171

72+
if (strict) {
73+
var first = firstchar(buf)
74+
75+
if (first !== '{' && first !== '[') {
76+
debug('strict violation')
77+
throw createStrictSyntaxError(parser, reviver, buf, first)
78+
}
79+
}
80+
7281
try {
7382
debug('parse json')
74-
return parser(body, reviver)
83+
return parser(buf, reviver)
7584
} catch (e) {
7685
throw normalizeJsonSyntaxError(e, {
7786
message: e.message,

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
j{
1+
{
22
"name": "body-parser",
33
"description": "Node.js body parsing middleware",
44
"version": "2.0.2",
@@ -48,4 +48,4 @@ j{
4848
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
4949
"test-cov": "nyc --reporter=html --reporter=text npm test"
5050
}
51-
}
51+
}

0 commit comments

Comments
 (0)