function matchOnTemplate(flatTemplate,rrpair,flatPayload,flatReqData,path){
    var returnOptions = {};
    const trimmedPayload = {}; const trimmedReqData = {};
      var hasBlank = false;
      for (let field in flatTemplate) {

        //If we have a condition here, handle its special properties
        if(flatTemplate[field]){
            var ret = preProcessCondition(field,flatTemplate[field],flatPayload);
            if(ret !== false){
                mergeInOptions(returnOptions,ret);
            }else{
                return false;
            }
        //Otherwise add this to the list to get literal equals'd
        }else{
            hasBlank = true;
            trimmedPayload[field] = flatPayload[field];
            trimmedReqData[field] = flatReqData[field];
        }
      }
      
      logEvent(path, rrpair.label, 'received payload (from template): ' + JSON.stringify(trimmedPayload, null, 2));
      logEvent(path, rrpair.label, 'expected payload (from template): ' + JSON.stringify(trimmedReqData, null, 2));

      if(hasBlank && !deepEquals(trimmedPayload, trimmedReqData)){
          return false;
      }

      // make sure we're not comparing {} == {}
      if (hasBlank && JSON.stringify(trimmedPayload) === '{}') {
        return false;
      }
      return returnOptions;
}
/**
 * Tests a payload against a request using a template. Returns any template options that were parsed (e.g. mapping vars)
 * @param {*} flatTemplate The flattened template
 * @param {*} rrpair RR Pair in question
 * @param {*} flatPayload Flattened payload
 * @param {*} flatReqData Flattened reqData from RR pair
 * @param {*} path Path of this req (for debug logging)
 */
Tests a payload against a request using a template.
Tests a payload against a request using a template .
function matchOnTemplate(flatTemplate,rrpair,flatPayload,flatReqData,path){
    var returnOptions = {};
    const trimmedPayload = {}; const trimmedReqData = {};
      var hasBlank = false;
      for (let field in flatTemplate) {
        if(flatTemplate[field]){
            var ret = preProcessCondition(field,flatTemplate[field],flatPayload);
            if(ret !== false){
                mergeInOptions(returnOptions,ret);
            }else{
                return false;
            }
        }else{
            hasBlank = true;
            trimmedPayload[field] = flatPayload[field];
            trimmedReqData[field] = flatReqData[field];
        }
      }
      logEvent(path, rrpair.label, 'received payload (from template): ' + JSON.stringify(trimmedPayload, null, 2));
      logEvent(path, rrpair.label, 'expected payload (from template): ' + JSON.stringify(trimmedReqData, null, 2));
      if(hasBlank && !deepEquals(trimmedPayload, trimmedReqData)){
          return false;
      }
      if (hasBlank && JSON.stringify(trimmedPayload) === '{}') {
        return false;
      }
      return returnOptions;
}
function matchOnTemplate ( flatTemplate , rrpair , flatPayload , flatReqData , path ) { var returnOptions = { } ; const trimmedPayload = { } ; const trimmedReqData = { } ; var hasBlank = false ; for ( let field in flatTemplate ) { if ( flatTemplate [ field ] ) { var ret = preProcessCondition ( field , flatTemplate [ field ] , flatPayload ) ; if ( ret !== false ) { mergeInOptions ( returnOptions , ret ) ; } else { return false ; } } else { hasBlank = true ; trimmedPayload [ field ] = flatPayload [ field ] ; trimmedReqData [ field ] = flatReqData [ field ] ; } } logEvent ( path , rrpair . label , 'received payload (from template): ' + JSON . stringify ( trimmedPayload , null , 2 ) ) ; logEvent ( path , rrpair . label , 'expected payload (from template): ' + JSON . stringify ( trimmedReqData , null , 2 ) ) ; if ( hasBlank && ! deepEquals ( trimmedPayload , trimmedReqData ) ) { return false ; } if ( hasBlank && JSON . stringify ( trimmedPayload ) === '{}' ) { return false ; } return returnOptions ; }
Tests a payload against a request using a template.
Tests a payload against a request using a template .
//If we have a condition here, handle its special properties //Otherwise add this to the list to get literal equals'd // make sure we're not comparing {} == {}