Get the Set-Cookie from Response header
vijaychowthri opened this issue · comments
i was trying to get set-cookie values to post another request in protractor, but i couldn't get the value of the cookie (XYZ_TOKEN value is required to post the another request).
frisby version ^2.1.0
var ipCookies = 'dfadsfadsf%546321fdskgs374934832sdfgdsg';
var respo = await frisby.get("https://services.xyz.org/dspor/index.cfm?fuseaction=login.login&thread=jump.SRS",
{request :{
followRedirect: true,
headers: {
'Cookie': ipCookies,
'Content-Type': 'application/json;charset=utf-8',
'Cache' : 'no-cache',
},
}
}).inspectHeaders().expect('status', 200);
This is my response in the command line
Response Headers:
set-cookie: XYZ_TOKEN=31689ABE%2D0EFF%2DEDDA%2DFE88CEE3D632EBEC; Path=/,AAMC_URI_PERSISTENCE=!wgmIFvbugbJQtpIl4s
content-type: text/html;charset=UTF-8
cache-control: no-cache
content-encoding: gzip
transfer-encoding: chunked
like following code.
const frisby = require('frisby');
it('get set-cookie', () => {
return frisby.get('https://www.google.com/')
.expect('status', 200)
.then(res => {
let setCookie = res.headers.get('set-cookie');
console.log('setCookie', setCookie);
});
})
Thanks Much H1Gdev !!!
console.log('setCookie', setCookie);
how to store this cookies to be able to use is in multiple it block in headers
I used cookie-client in the past.
I used cookie-client in the past.
thanks solved by using convectional way res.headers and splitting the required cookies