Empty URL crashes the server

This commit is contained in:
Gaël Métais
2015-02-06 12:32:19 +01:00
parent dc9aa4d6b4
commit db6fdbc121
+1 -1
View File
@@ -21,7 +21,7 @@ var ApiController = function(app) {
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) {
if (req.body.url && req.body.url.toLowerCase().indexOf('http://') !== 0 && req.body.url.toLowerCase().indexOf('https://') !== 0) {
req.body.url = 'http://' + req.body.url;
}