소스 검색

Fix url in queue or dashboard pages without http://

Gaël Métais 10 년 전
부모
커밋
39e6ecc920
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      lib/server/controllers/apiController.js

+ 5 - 0
lib/server/controllers/apiController.js

@@ -20,6 +20,11 @@ var ApiController = function(app) {
     // Create a new run
     app.post('/api/runs', function(req, res) {
 
+        // Add http to the test URL
+        if (req.body.url.toLowerCase().indexOf('http://') !== 0 && req.body.url.toLowerCase().indexOf('https://') !== 0) {
+            req.body.url = 'http://' + req.body.url;
+        }
+
         // Grab the test parameters and generate a random run ID
         var run = {
             runId: (Date.now()*1000 + Math.round(Math.random()*1000)).toString(36),