Skip to content

Instantly share code, notes, and snippets.

@beders
Created April 17, 2015 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beders/1cb3b3f8ddba12d697f7 to your computer and use it in GitHub Desktop.
Save beders/1cb3b3f8ddba12d697f7 to your computer and use it in GitHub Desktop.
Odd side effects using eval
// 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