Add a way to block some urls to avoid spam (#219)

Spam blocker
This commit is contained in:
Gaël Métais
2017-01-08 22:38:34 +08:00
committed by GitHub
parent ecbbbc2d6b
commit f76d597cbf
6 changed files with 51 additions and 3 deletions
+24
View File
@@ -687,4 +687,28 @@ describe('api', function() {
});
});
it('should refuse a query on a blocked Url', function(done) {
this.timeout(5000);
request({
method: 'POST',
url: serverUrl + '/api/runs',
body: {
url: 'http://www.test.com/something.html',
waitForResponse: false
},
json: true,
headers: {
'Content-Type': 'application/json',
'X-Api-Key': Object.keys(config.authorizedKeys)[0]
}
}, function(error, response, body) {
if (!error && response.statusCode === 403) {
done();
} else {
done(error || response.statusCode);
}
});
});
});