Commit 7f1fcc8b 7f1fcc8bb811abe9c049ac7b495e91cf3d1af4e1 by Nicolas Perriault

clean urls in self test server uri handling

1 parent 661944c9
...@@ -18,9 +18,14 @@ function info(message) { ...@@ -18,9 +18,14 @@ function info(message) {
18 18
19 service = server.listen(testServerPort, function(request, response) { 19 service = server.listen(testServerPort, function(request, response) {
20 "use strict"; 20 "use strict";
21 var pageFile = fs.pathJoin(phantom.casperPath, request.url); 21 var requestPath = request.url;
22 if (requestPath.indexOf('?') !== -1) {
23 requestPath = request.url.split('?')[0];
24 }
25 var pageFile = fs.pathJoin(phantom.casperPath, requestPath);
22 if (!fs.exists(pageFile) || !fs.isFile(pageFile)) { 26 if (!fs.exists(pageFile) || !fs.isFile(pageFile)) {
23 response.statusCode = 404; 27 response.statusCode = 404;
28 console.log(utils.format('Test server url not found: %s (file: %s)', request.url, pageFile), "warning");
24 response.write("404 - NOT FOUND"); 29 response.write("404 - NOT FOUND");
25 } else { 30 } else {
26 response.statusCode = 200; 31 response.statusCode = 200;
......