diff --git a/routes/api.js b/routes/api.js index f175837..ca9afff 100644 --- a/routes/api.js +++ b/routes/api.js @@ -206,7 +206,7 @@ var run = function(req, res, runner){ return request.post(httpOptions, function(error, response, body){ // console.log('runner response:', arguments) - if(response.statusCode !== 200 || error) return run(req, res, getAvailrunner()); + if(error || response.statusCode !== 200) return run(req, res, getAvailrunner()); body = JSON.parse(body); body['ip'] = getAvailrunner(runner).label; diff --git a/testAPI.py b/testAPI.py new file mode 100644 index 0000000..9ae66a7 --- /dev/null +++ b/testAPI.py @@ -0,0 +1,10 @@ +import requests as r +import time + +def testAPI(times): + errors = 0 + + for i in range(times): + res = r.post('http://codeland.bytedev.co:2000/api/run', data={'code': 'pwd'}) + if res.status_code != 200: errors +=1 + print('errors ', errors) \ No newline at end of file