Comparing version 0.0.2 to 0.0.3
@@ -19,2 +19,3 @@ "use strict"; | ||
var serve = function (req, res) { | ||
@@ -43,2 +44,3 @@ var url = req.url.split('?')[0], | ||
} | ||
}; | ||
@@ -45,0 +47,0 @@ |
@@ -22,3 +22,3 @@ "use strict"; | ||
var p = parse(req.url), | ||
code = ((req.method === 'GET' || req.method === 'HEAD') ? 200 : 403); | ||
code = ((req.method === 'GET' || req.method === 'HEAD' || req.method === 'OPTIONS') ? 200 : 403); | ||
@@ -59,20 +59,22 @@ res.writeHead(code, headers); | ||
if (req.body) { //Express | ||
gotData = true; | ||
data = qs.stringify(req.body); | ||
} | ||
end(); | ||
} else { | ||
req.on('data', function (c) { | ||
gotData = true; | ||
data += c; | ||
}); | ||
req.on('data', function (c) { | ||
gotData = true; | ||
data += c; | ||
}); | ||
req.on('end', end); | ||
req.on('end', end); | ||
//Seems as if the post doesn't have data | ||
//the end event doesn't fire?? | ||
setTimeout(function () { | ||
if (!gotData) { | ||
end(); | ||
} | ||
}, 75); | ||
//Seems as if the post doesn't have data | ||
//the end event doesn't fire?? | ||
setTimeout(function () { | ||
if (!gotData) { | ||
end(); | ||
} | ||
}, 750); | ||
} | ||
}; | ||
@@ -79,0 +81,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"author": "Dav Glass <davglass@gmail.com>", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"dependencies": { | ||
@@ -8,0 +8,0 @@ }, |
@@ -33,2 +33,4 @@ EchoEcho | ||
__I recommend using it with Express/Connect to get a properly parsed body for POST/PUT requests__ | ||
There are 3 things you need to do inside the Node server providing these tests: | ||
@@ -35,0 +37,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14914
366
90