My question: The API, I am working with has been coded in a way that the TOKEN which I want does not appears in the body or headers section. Instead it comes in console under Response Header. How can I get that value?
It looks like that original request is redirected (302 status) to a different URL which contains the Location header. That information wasn’t part of the original questions and missing the the cropped image.
As that code snippet is in the original request, the Location header isn’t part of that response - that’s why it’s undefined
If you go to settings and disable “Automatically follow redirects”, then add this to the Tests:
const querystring = require('querystring');
let params = pm.response.headers.get('Location').split('?')
console.log(querystring.parse(`${_.last(params)}`).sssToken)
It’s probably not what you need as it wouldn’t complete the flow you need - I’m unsure have to get the headers from a redirected URL in an efficient way