Replies: 2 comments
-
Hi, function findAndSetLocation(item){
if(item['key']=='token'){
pw.env.set("token", item['value'])
}
}
var headers = pw.response.headers
headers.forEach(findAndSetLocation) I hope this is helpful to you. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey there, yeah, const headers = new Map(pw.response.headers.map(item => [item['key'], item['value']]))
pw.env.set("uid", headers.get("uid"))
pw.env.set("expire", headers.get("expiry"))
pw.env.set("client", headers.get("client"))
pw.env.set("token", headers.get("access-token"))
pw.env.set("authorization", headers.get("authorization")) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I get a specific header value from the response object so that I can set it as an env variable?
Currently, I only get "Could not execute post-request script" but no detailed error message.
Example:
pw.env.set("token", pw.response.headers.get('token'));
Beta Was this translation helpful? Give feedback.
All reactions