-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jsonBodyParser fails with invalid JSON when the first invalid character is % #1411
Comments
Curretly the only workaround is doing:
However! |
Here is a small code snippet to replicate. index.js
CURL
Error
package.json
|
It does not seem to be fixed. I just got the same error on the newest version:
The payload mas a malformed JSON: |
I'm not confident this has shipped yet. |
It's already fixed. |
Bug Report
Sending invalid JSON with % as the first invalid character to bodyParser will crash restify.
For example the following payload will always fail:
With other invalid characters the jsonBodyParser works as expeceted.
Restify Version
v 5.0.0
Node.js Version
v 6.10.3
Expected behaviour
Should return:
Actual behaviour
Repro Case
See: #1411 (comment)
Cause
lib/plugins/jsonBodyParser.js
https://github.com/restify/node-restify/blob/5.x/lib/plugins/jsonBodyParser.js#L37
If the
e.message
contains the character%
the crash will occur.The text was updated successfully, but these errors were encountered: