Created
April 17, 2015 05:16
-
-
Save beders/1cb3b3f8ddba12d697f7 to your computer and use it in GitHub Desktop.
Odd side effects using eval
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run with: curl -d 'console.log("hi");' http://localhost:8063; curl -d 'console.log("hi");' http://localhost:8063 | |
vertx.createHttpServer().requestHandler(function (req) { | |
req.bodyHandler(function (buffer) { | |
var code = buffer.toString("UTF-8"); | |
var result = eval('"use strict";' + code) || {}; | |
req.response().end(JSON.stringify(result)); | |
}); | |
}).listen(8063); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment