Ok, I think I see what you’re trying to do.
See if this works.
In your Pre-Request:
//Set Time
var moment = require("moment");
var time = moment().valueOf();
pm.environment.set('time', time);
//Set Data
var eventArray = [];_
for(var i = 1; i <= 50; i++) {
var t = time + (i * 1000);
eventArray.push({
"eid": i,
"time": t
});
}
var data = { "event": eventArray };
var JSONData = new Buffer(JSON.stringify(data)).toString();
pm.environment.set("JSONData", JSONData);
console.log("JSONDATA", JSONData);
Change your entire request body to the following variable:
{{JSONData}}
This is what would be sent:
{“event”:[{“eid”:1,“time”:1538518294839},{“eid”:2,“time”:1538518295839},{“eid”:3,“time”:1538518296839},{“eid”:4,“time”:1538518297839},{“eid”:5,“time”:1538518298839},{“eid”:6,“time”:1538518299839},{“eid”:7,“time”:1538518300839},{“eid”:8,“time”:1538518301839},{“eid”:9,“time”:1538518302839},{“eid”:10,“time”:1538518303839},{“eid”:11,“time”:1538518304839},{“eid”:12,“time”:1538518305839},{“eid”:13,“time”:1538518306839},{“eid”:14,“time”:1538518307839},{“eid”:15,“time”:1538518308839},{“eid”:16,“time”:1538518309839},{“eid”:17,“time”:1538518310839},{“eid”:18,“time”:1538518311839},{“eid”:19,“time”:1538518312839},{“eid”:20,“time”:1538518313839},{“eid”:21,“time”:1538518314839},{“eid”:22,“time”:1538518315839},{“eid”:23,“time”:1538518316839},{“eid”:24,“time”:1538518317839},{“eid”:25,“time”:1538518318839},{“eid”:26,“time”:1538518319839},{“eid”:27,“time”:1538518320839},{“eid”:28,“time”:1538518321839},{“eid”:29,“time”:1538518322839},{“eid”:30,“time”:1538518323839},{“eid”:31,“time”:1538518324839},{“eid”:32,“time”:1538518325839},{“eid”:33,“time”:1538518326839},{“eid”:34,“time”:1538518327839},{“eid”:35,“time”:1538518328839},{“eid”:36,“time”:1538518329839},{“eid”:37,“time”:1538518330839},{“eid”:38,“time”:1538518331839},{“eid”:39,“time”:1538518332839},{“eid”:40,“time”:1538518333839},{“eid”:41,“time”:1538518334839},{“eid”:42,“time”:1538518335839},{“eid”:43,“time”:1538518336839},{“eid”:44,“time”:1538518337839},{“eid”:45,“time”:1538518338839},{“eid”:46,“time”:1538518339839},{“eid”:47,“time”:1538518340839},{“eid”:48,“time”:1538518341839},{“eid”:49,“time”:1538518342839},{“eid”:50,“time”:1538518343839}]}
Mick