From b8dfaff8613802d12d69973e56bd369925460fa7 Mon Sep 17 00:00:00 2001 From: william Date: Mon, 30 May 2016 17:27:21 -0400 Subject: [PATCH] stuff --- routes/api.js | 2 +- testAPI.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 testAPI.py 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