postman-app-support icon indicating copy to clipboard operation
postman-app-support copied to clipboard

I am running newman as a library and has couple of API's in sequence. My requirement is to mofidy "Request Headers" in "beforeRequest" for API-2 based on some data received from API-1. Event?

Open safhusain opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the tracker for existing similar issues and I know that duplicates will be closed

Describe the Issue

I am running newman as a library and has couple of API's in sequence. My requirement is to mofidy "Request Headers" in "beforeRequest" for API-2 based on some data received from API-1. Event?

.on('beforeRequest', function (err, args) { var req = args.request; args.request.header.push = {"key" : <Some-Key>, "value" : <Some-Value>}

newMan triggers new API without new Headers on it. Is it even possible in NewMan?

Steps To Reproduce

newman.run({ collection: require(process.env.collection), reporters: 'cli', environment: require(process.env.environment), folder: process.env.folder, iterationData: process.env.data

}).on('start', function (err, summary) { // on start of run, log to console console.log('NewMan --- running a collection...');

}).on('beforeRequest', function (err, args) { var req = args.request; args.request.header.push = {"key" : <Some-Key>, "value" : <Some-Value>}

Screenshots or Videos

No response

Operating System

Windows

Postman Version

10.24

Postman Platform

Both

User Account Type

Signed In User

Additional Context?

This is a problem with NewMan which doesnt allow to change any header (or Body) info in "beforeRequest" event.

safhusain avatar Apr 21 '24 09:04 safhusain