cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject git commit: Upload return data is now valid JSON
Date Thu, 08 May 2014 19:20:40 GMT
Repository: cordova-labs
Updated Branches:
  refs/heads/cordova-filetransfer 44dba1b5b -> acd7e6e28


Upload return data is now valid JSON


Project: http://git-wip-us.apache.org/repos/asf/cordova-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-labs/commit/acd7e6e2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-labs/tree/acd7e6e2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-labs/diff/acd7e6e2

Branch: refs/heads/cordova-filetransfer
Commit: acd7e6e28a9633b320817da93e29610adff608bd
Parents: 44dba1b
Author: Shazron Abdullah <shazron@apache.org>
Authored: Thu May 8 12:20:30 2014 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Thu May 8 12:20:30 2014 -0700

----------------------------------------------------------------------
 package.json |  5 +++--
 server.js    | 11 +++++------
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/acd7e6e2/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 1527b31..2ed0548 100644
--- a/package.json
+++ b/package.json
@@ -4,11 +4,12 @@
   "scripts": {
     "start": "server.js"
   },
-  "version": "0.0.8",
+  "version": "0.0.9",
   "engines": {
-    "node": ">=0.8.0"
+    "node": ">=0.10.0"
   },
   "dependencies": {
+    "json-stringify-safe": "5.0.0",
     "formidable": "1.0.x"
   }
 }

http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/acd7e6e2/server.js
----------------------------------------------------------------------
diff --git a/server.js b/server.js
index 1eb2958..dc715de 100644
--- a/server.js
+++ b/server.js
@@ -2,6 +2,7 @@ var formidable = require('formidable'),
     http = require('http'),
     util = require('util'),
     port = process.env.PORT || 5000;
+    stringify = require('json-stringify-safe');
 
 http.createServer(function (req, res) {
 	
@@ -35,10 +36,9 @@ http.createServer(function (req, res) {
         var form = new formidable.IncomingForm();
         form.parse(req, function(err, fields, files) {
             res.writeHead(200, {'content-type': 'text/plain'});
-            console.log(util.inspect({fields: fields, files: files}));
+            console.log(stringify({fields: fields, files: files}));
             
-            res.write('received upload:\n\n');
-            res.write(util.inspect({fields: fields, files: files}));
+            res.write(stringify({fields: fields, files: files}));
             console.log
             res.end("\n");
         });
@@ -50,10 +50,9 @@ http.createServer(function (req, res) {
 	        var form = new formidable.IncomingForm();
 	        form.parse(req, function(err, fields, files) {
 	            res.writeHead(200, {'content-type': 'text/plain'});
-	            console.log(util.inspect({fields: fields, files: files}));
+	            console.log(stringify({fields: fields, files: files}));
 
-	            res.write('received upload:\n\n');
-	            res.write(util.inspect({fields: fields, files: files}));
+	            res.write(stringify({fields: fields, files: files}));
 	            console.log
 	            res.end("\n");
 	        });


Mime
View raw message