mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
more testing
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
const request = require('request');
|
||||
//require('request-debug')(request);
|
||||
const makeTask = require('../tasks/make_task');
|
||||
const normalizeJamones = require('./normalize-jamones');
|
||||
|
||||
const debug = require('debug')('jambonz:feature-server');
|
||||
const retrieveApp = require('./retrieve-app');
|
||||
|
||||
function hooks(logger, callAttributes) {
|
||||
debug(`notifiers: callAttributes ${JSON.stringify(callAttributes)}`);
|
||||
function actionHook(url, method, auth, opts, expectResponse = false) {
|
||||
function actionHook(url, method, auth, opts, expectResponse = true) {
|
||||
const params = Object.assign({}, callAttributes, opts);
|
||||
let basicauth, qs, body;
|
||||
if (auth && typeof auth === 'object' && Object.keys(auth) === 2) basicauth = auth;
|
||||
@@ -21,12 +16,9 @@ function hooks(logger, callAttributes) {
|
||||
logger.info(`actionHook error ${method} ${url}: ${err.message}`);
|
||||
return reject(err);
|
||||
}
|
||||
if (body) {
|
||||
if (body && expectResponse) {
|
||||
logger.debug(body, `actionHook response ${method} ${url}`);
|
||||
if (expectResponse) {
|
||||
const tasks = normalizeJamones(logger, body).map((tdata) => makeTask(logger, tdata));
|
||||
return resolve(tasks);
|
||||
}
|
||||
return resolve(retrieveApp(logger, body));
|
||||
}
|
||||
resolve(body);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user