Archived topic — this may be out of date.
Newman has been replaced by the Postman CLI, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.
Working with an AI coding agent? The Postman plugin lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.
Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.
Javascript array.push command produces different results when run in Postman App vs Newman Command Line.
Right now I have tempBody defined as:
var tempBody = {};
• Then set to tempBody = pm.request.body; if request.body has content.
• Or set to tempBody = {"mode":"NoBody"}; if no request body.
Once set I create an element in the array as follows.
• tempArray.push({"reqName":pm.info.requestName, "reqUrl":pm.request.url, "reqBody":tempBody});
I then add it as an updated environment value:
• pm.environment.set("compareArray", tempArray);
In postman app, this statement:
console.log("my tempArray is : ", tempArray);
Produces the following, which includes the Body whether it exists or not. However, when I export and run this script in newman, the reqBody element is missing from the array of json objects.
See an example at the bottom.
Array:[]
0:{}
reqBody:{}
mode:"urlencoded"
urlencoded:[]
0:{}
key:"……."
value:"……."
1:{}
key:"…….."
value:"……."
2:{}
key:"…….."
value:"……"
reqName:"Get Token for Tests"
reqUrl:{}
host:[]
0:"{{baseUrl}}"
path:[]
0:"v3"
1:"tokens"
query:[]
variable:[]
1:{}
reqBody:{}
mode:"NoBody"
reqName:"FolderEnd"
reqUrl:{}
host:[]
0:"{{baseUrl}}"
path:[]
0:"v3"
1:"mymixchannels"
query:[]
variable:
When the same script is run in newman command line:
{
"type": "any",
"value": [
{
"reqName": "Get Token for Tests",
"reqUrl": {
"path": [
"v3",
"tokens"
],
"host": [
"{{baseUrl}}"
],
"query": [],
"variable": []
},
"reqBody": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "……….",
"value": "………."
},
{
"key": "……….",
"value": "………."
},
{
"key": "………",
"value": "…………"
}
]
}
},
{
"reqName": "FolderEnd",
// ******* There is no "reqBody" here ***********
"reqUrl": {
"path": [
"v3",
"mymixchannels"
],
"host": [
"{{baseUrl}}"
],
"query": [],
"variable": []
}
}
],
"key": "compareArray"
},