postman-app-support
postman-app-support copied to clipboard
Environment Variables that have been updated while Websocket opened, are not available to Websocket requests
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
Have an issue where an environment variable is updated while a WebSocket request is still open. The value of that updated variable is not available to the Websocket until the websocket is disconnected and reconnected.
Steps To Reproduce
I have the following setup:
- A REST request that POSTs to an endpoint
/oauth/token- The request returns an
access_tokenin a json response - A post-res script is setup like so:
let response = pm.response.json(); let token = response.access_token; pm.environment.set("token", token );
- The request returns an
- A Websocket request is initiated
- a message is sent with the following format:
{ "messageType": "tp:AuthRequest", "token": "{{token}}" }
- a message is sent with the following format:
- The
{{token}}is sent in the Websocket request - If you were re-execute
#1to get a new token, then re-execute#2, the websocket request would use thetokenfrom the first time you had executed#1, not the subsequent time. - If you disconnect the Websocket, then reconnect it and re-issue the request from
#2, then it'll use the updated token from the second time you had executed#1
Screenshots or Videos
No response
Operating System
Windows
Postman Version
11.38.2
Postman Platform
Postman App
User Account Type
Signed In User
Additional Context?
No response