clean urls in self test server uri handling
Showing
1 changed file
with
6 additions
and
1 deletions
... | @@ -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; | ... | ... |
-
Please register or sign in to post a comment