Compare View
Commits (2)
Changes
Showing 5 changed files Side-by-side Diff
config.sample.json
lib/coreapi/request.js
... | ... | @@ -4,7 +4,6 @@ const request = require('request'); |
4 | 4 | const uniqid = require('uniqid'); |
5 | 5 | |
6 | 6 | const coreUrl = require('komodo-sdk/core-url'); |
7 | -const config = require('komodo-sdk/config'); | |
8 | 7 | const logger = require('komodo-sdk/logger'); |
9 | 8 | const commandError = require('../command-handler/error'); |
10 | 9 | |
... | ... | @@ -66,19 +65,20 @@ function execute(coreEndpoint, params, httpMethod, cb) { |
66 | 65 | xid, coreResponseObject, |
67 | 66 | }); |
68 | 67 | |
69 | - // jangan kirim reply rc 68 jika origin/center ada di do_not_forward_rc68_to_centers | |
70 | - if ( | |
71 | - coreResponseObject && coreResponseObject.rc === '68' | |
72 | - && config && config.do_not_forward_rc68_to_centers | |
73 | - && params && params.origin && params.origin.trim() | |
74 | - && typeof params.origin === 'string' | |
75 | - && Array.isArray(config.do_not_forward_rc68_to_centers) | |
76 | - && config.do_not_forward_rc68_to_centers | |
77 | - .map((item) => item && (typeof item === 'string') && item.trim().toUpperCase()) | |
78 | - .indexOf(params.origin.trim().toUpperCase()) >= 0 | |
79 | - ) { | |
80 | - return; | |
81 | - } | |
68 | + // jangan kirim reply rc 68 jika origin/center ada di do_not_forward_rc68_to_centers. | |
69 | + // tidak jadi, ditangani di center masing2 via komodo-center-messaging-lib | |
70 | + // if ( | |
71 | + // coreResponseObject && coreResponseObject.rc === '68' | |
72 | + // && config && config.do_not_forward_rc68_to_centers | |
73 | + // && params && params.origin && params.origin.trim() | |
74 | + // && typeof params.origin === 'string' | |
75 | + // && Array.isArray(config.do_not_forward_rc68_to_centers) | |
76 | + // && config.do_not_forward_rc68_to_centers | |
77 | + // .map((item) => item && (typeof item === 'string') && item.trim().toUpperCase()) | |
78 | + // .indexOf(params.origin.trim().toUpperCase()) >= 0 | |
79 | + // ) { | |
80 | + // return; | |
81 | + // } | |
82 | 82 | |
83 | 83 | cb(err, coreResponseObject, responseParams); |
84 | 84 | }) |
lib/http-listener.js
... | ... | @@ -105,11 +105,9 @@ function mainHandler(req, res) { |
105 | 105 | commandHandler(req.body.msg || req.query.msg, params, function(err, coreResponseObject, responseParams) { |
106 | 106 | if (err) { |
107 | 107 | res.end('ERROR. ' + err); |
108 | - } | |
109 | - else if (coreResponseObject) { | |
108 | + } else if (coreResponseObject) { | |
110 | 109 | res.json(coreResponseObject); |
111 | - } | |
112 | - else { | |
110 | + } else { | |
113 | 111 | res.end(responseParams.body); |
114 | 112 | } |
115 | 113 | }) |
package-lock.json