-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blocking event listeners #1698
Comments
@adamp524 This isn't currently possible, as event handling works in fire and forget mode, so to speak. Could you elaborate a bit on your use case? |
We're running Newman tests on a network with a corporate proxy. I'm trying to parse a proxy pac file and set the http_proxy and https_proxy environment variables before the main request is issued. If Newman had support for setting a proxy Pac URL that would be a really useful improvement. The npm pac-resolver library or similar is something you could use to easily read and parse. |
@adamp524 Thanks for the context. Based on the snippet you'd shared above, you could shift the logic in the start event handler to before the run even starts. This ensures that the run only starts after your preparatory logic has completed its work. Based on the file parsing structure, you can update the values of the proxy environment variables in the |
@kunagpal Our tests dynamically load in environment URLs, credentials etc. in the 'Pre-request' portion of a postman script. We don't know the full URL that the main request is going to be hitting until after the pre-request stage has been run. You mention using the 'start' event handler however is there still not a risk of the script proceeding to further stages as the events are fire and forget? |
Yep. There’s no way to block it. Even I wanted to block some events for a newman debugging reporter I was planning. On top of it, blocking events is first an anti pattern and secondly it would go against the architecture of newman’s internals. So, on that ground we have nowhere to go - as far as I can think of. For the proxy PAC file thing, we have support for that in our app. Wondering what effort would it take to bring the same to Newman. I’m closing this ticket and creating a new feature request. 😊 |
Hi,
I'm running postman collections using the newman node runner. I would like to intercept calls to various events such as 'start', 'beforeRequest', 'request' but have them block before continuing to the next stage. As far as I can tell, the handlers that are currently exposed are just triggers on events and can't block.
Does anyone know if it's possible to intercept events and block in this way?
The text was updated successfully, but these errors were encountered: