diff options
author | 2018-04-06 12:41:29 -0400 | |
---|---|---|
committer | 2018-04-06 12:41:29 -0400 | |
commit | f8cab3eebdcee288332e16bda5bd6b2fa17e02ac (patch) | |
tree | fd7d6064ad9f712a982f413d36a30c6f779460af /lib/promise_request.js | |
parent | 1c2fb197d1b406a6764dde9dddd14caa8c50713a (diff) |
4.4.1 deployment-handler -unit tests 84% coverage
- more logging on metrics - log both req and res
- unit tests of policy-update API
- log timing and messaging in unit tests
- code coverage
84.28% Statements 938/1113
65.51% Branches 321/490
81.58% Functions 155/190
84.34% Lines 926/1098
Change-Id: I3587135ceac76b291f83753441421a917a8b8bdf
Signed-off-by: Alex Shatov <alexs@att.com>
Issue-ID: DCAEGEN2-258
Diffstat (limited to 'lib/promise_request.js')
-rw-r--r-- | lib/promise_request.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/promise_request.js b/lib/promise_request.js index 68e8c2f..c34227d 100644 --- a/lib/promise_request.js +++ b/lib/promise_request.js @@ -113,16 +113,18 @@ exports.doRequest = function(mainReq, options, body, targetEntity) { } opInfo.respCode = resp.statusCode || 500; + const metrics_text = "res: " + result.body + + ((reqBody && " req: " + ((typeof(reqBody) !== 'string' && typeof(reqBody)) || reqBody)) || ""); if (resp.statusCode > 199 && resp.statusCode < 300) { // HTTP status code indicates success - resolve the promise opInfo.complete = true; - logger.metrics(mainReq, opInfo, result.body); + logger.metrics(mainReq, opInfo, metrics_text); resolve(result); } else { // Reject the promise opInfo.complete = false; - logger.metrics(mainReq, opInfo, result.body); + logger.metrics(mainReq, opInfo, metrics_text); reject(result); } |