Commits

Magnus Hoff committed fd0efae

Fixed bug with calculating Location

  • Participants
  • Parent commits 2df4cf0

Comments (0)

Files changed (1)

File example-crud.js

 };
 
 ListResource.prototype.http_POST = function (req, res) {
+	var self = this;
 	var form = new formidable.IncomingForm();
 
 	form.parse(req, function(err, fields, files) {
 				"Content-Type": files.file.type,
 				"body": data
 			};
-			var id = db.push(item);
+			var id = db.push(item) - 1;
 
-			var location = url.resolve(req.url, this.dataRoot + id);
+			var location = url.resolve(req.url, self.dataRoot + id);
+			console.log(req.url);
+			console.log(self.dataRoot);
+			console.log(id);
+			console.log(location);
 			res.writeHead(201, {
 				"Content-Type": "text/html;charset=utf-8",
 				"Location": location