Skip to content

Commit

Permalink
Recorder + invo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlegeyt committed Mar 20, 2019
1 parent 0db316f commit 45853b7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions controllers/recorderController.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,15 @@ function stripRRPairForReq(rrpair) {

if(myRRPair.payloadType == "JSON"){
//Even if its supposed to be JSON, and it fails parsing- record it! This may be intentional from the user
try{
myRRPair.reqData = JSON.parse(req.body);
}catch(err){
if(typeof req.body == "string"){
try{
myRRPair.reqData = JSON.parse(req.body);
}catch(err){
myRRPair.reqData = req.body;
myRRPair.payloadType = "PLAIN";
}
}else{
myRRPair.reqData = req.body;
myRRPair.payloadType = "PLAIN";
}
}
else
Expand Down
12 changes: 8 additions & 4 deletions routes/invoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ function createRRPairFromReqRes(req,res,service){
}
if(myRRPair.payloadType == "JSON"){
//Even if its supposed to be JSON, and it fails parsing- record it! This may be intentional from the user
try{
myRRPair.reqData = JSON.parse(req.body);
}catch(err){
if(typeof req.body == "string"){
try{
myRRPair.reqData = JSON.parse(req.body);
}catch(err){
myRRPair.reqData = req.body;
myRRPair.payloadType = "PLAIN";
}
}else{
myRRPair.reqData = req.body;
myRRPair.payloadType = "PLAIN";
}
}
else
Expand Down

0 comments on commit 45853b7

Please sign in to comment.