Archived
2

/api/ subroutes only available in dev/test

This commit is contained in:
VLE2FE
2020-05-28 12:18:38 +02:00
parent 0ea28fa50a
commit 8276e5108c
5 changed files with 43 additions and 10 deletions

View File

@ -43,7 +43,7 @@ export default class TestHelper {
db.disconnect(done);
}
static request (server, done, options) { // options in form: {method, url, auth: {key/basic: 'name' or 'key'/{name, pass}}, httpStatus, req, res}
static request (server, done, options) { // options in form: {method, url, auth: {key/basic: 'name' or 'key'/{name, pass}}, httpStatus, req, res, default (set to false if you want to dismiss default .end handling)}
let st = supertest(server);
if (options.hasOwnProperty('auth') && options.auth.hasOwnProperty('key')) { // resolve API key
options.url += '?key=' + (this.auth.hasOwnProperty(options.auth.key)? this.auth[options.auth.key].key : options.auth.key);