{
const authourizationUrl = `my_url`;
const jar = http.cookieJar();
jar.set(authourizationUrl, sessionCookieName, sessionCookieValue); //set cookies from autherization call in the jar
const r2 = http.get(authourizationUrl, { jar: jar, redirects: 0 });
for (const value in r2.headers) {
if (r2.headers.hasOwnProperty(value)) {
console.log(`${value}: ${r2.headers[value]}`);
}
}
new Map(Object.entries(r2.cookies)).forEach((v2, k2) => {
logCookie(v2[0]);
});
check(r2, {
'authorize call has status 302': (r) => r2.status === 302, //pass
"authorize call response is not null": r2 => r2.headers != null, //pass
});
console.log(`status 302 expected, got -->: ${r2.status}`); //302 as expected
console.log(`headers location is: ${r2.headers.Location}`); //logged the location header
console.log(`headers location code is: ${r2.headers.Location.code}`); // undefined. authorizationCode is not present in the response headers
}