Commit 15585ce11e0db9eb219409550697155d00d85c27

Authored by Adhidarma Hadiwinoto
1 parent cb60c0cd49
Exists in master

perbaikan filter task tidak valid pada advice server

Showing 1 changed file with 2 additions and 9 deletions Side-by-side Diff

gateway/advice-push-server.js
... ... @@ -47,16 +47,9 @@ function adviceHandler(req, res, next) {
47 47 return;
48 48 }
49 49  
50   - let task = null;
  50 + let task = req.body;
51 51  
52   - try {
53   - task = JSON.parse(req.body);
54   - }
55   - catch(e) {
56   - logger.warn('PUSH-ADVICE: Exception on parsing task to advice', {err: e, body: req.body});
57   - }
58   -
59   - if (!task) {
  52 + if (!task || !task.trx_id || !task.destination || !task.product) {
60 53 logger.warn('PUSH-ADVICE: Invalid task');
61 54 res.end('INVALID_TASK');
62 55 return;