Permalink
Browse files

Changed format to accept anything in req.body

  • Loading branch information...
1 parent fe12b32 commit 9c1660bae934b422413028a106212c8809c7b634 Mark Cahill committed Sep 12, 2011
Showing with 11 additions and 2 deletions.
  1. +11 −2 server.js
View
@@ -27,11 +27,20 @@ app.post('/input/:input', function(req, res, next) {
return;
}
- // Send success
- var data = JSON.parse(req.body.source);
+ // Prepare data
+ var data = {};
+ for (var el in req.body) {
+ if (req.body.hasOwnProperty(el) && el[0] !== "_") {
+ data[el] = unescape(req.body[el]);
+ }
+ }
+
+ // Notify listeners of new data
for (var i = 0; i < telemetry.inputs[input].length; i++) {
telemetry.inputs[input][i].post(data);
}
+
+ // Send success
res.end('', 200);
});

0 comments on commit 9c1660b

Please sign in to comment.