diff --git a/test/html/service.html b/test/html/service.html index deb760f..583fc64 100644 --- a/test/html/service.html +++ b/test/html/service.html @@ -1 +1,120 @@ -THONG \ No newline at end of file + + + Test KeeeX API + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ Host address + + +
+ Port + + +
+ Action + + +
+ File path + + +
+ +
+ Return code + + +
+ Return value + + +
+ + + \ No newline at end of file diff --git a/test/js/service.js b/test/js/service.js index 6c83f19..55e31f1 100644 --- a/test/js/service.js +++ b/test/js/service.js @@ -12,39 +12,43 @@ var server = http.createServer(function(request, response) { response.writeHead(200); if (action=="keeexit") { - - if (!path && fs.existsSync(path)) + if (path && fs.existsSync(path)) { response.writeHead(200); /*TODO return the path to the keeexed file or its content - */ + */ + response.write("This must be path to the keeexed file"); } else { //return bad request response.writeHead(400); + response.write("bad argument for keeex"); } } else if (action=="verify") { - if (!path && fs.existsSync(path)) + if (path && fs.existsSync(path)) { response.writeHead(200); /*TODO return whether the file is in the lastest version */ + response.write("This must be true or false"); } else { //return bad request response.writeHead(400); + response.write("bad argument for verify"); } } else { //action not supported response.writeHead(404); + response.write("action not supported"); } response.end(); diff --git a/test/js/test.js b/test/js/test.js index 1121ad9..1e1cb3a 100644 --- a/test/js/test.js +++ b/test/js/test.js @@ -1,14 +1,10 @@ var http = require('http'); - function getStatusCode(request, callback) { var options = { host: "127.0.0.1", port: 3000, path: request, - headers: { - Host: request - } }; http.get(options, function(response) { callback(response.statusCode);