1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-22 17:16:55 +01:00

Use safer JSON.parse() instead of eval()

Closes #2004
This commit is contained in:
Benjamin Browning 2018-04-04 23:09:53 -04:00
parent c9615e7a87
commit ce35ac544d

View File

@ -175,7 +175,7 @@ var GuzzleServer = function(port, log) {
}
res.writeHead(400, 'NO RESPONSES IN REQUEST', { 'Content-Length': 0 });
} else {
that.responses = eval('(' + request.body + ')');
that.responses = JSON.parse(request.body);
for (var i = 0; i < that.responses.length; i++) {
if (that.responses[i].body) {
that.responses[i].body = new Buffer(that.responses[i].body, 'base64');