Hi,
I need some help with capturing Set-Cookies, please.
So, one route sends three Set-Cookies back from the endpoint. I’m supposed to capture these cookies and manipulate them (add them to the response body).
However, I’m only able to capture the JSESSIONID cookie, and no other. I can’t see the other cookies on Trace, but they all appear on Postman.
I’ve tried addind the property to target configuration:
Set-Cookie.
I’ve tried capturing these cookies with (from reading other solutions here on the community):
- context.getVariable(‘response.header.set-cookie.values’) + ‘’;
var a = hdr.substring(1, hdr.length - 1).split(‘,’);
-
context.getVariable(‘response.header.set-cookie.values.string’);
-
context.getVariable(“message.header.Set-Cookie”);
-
context.targetResponse.headers[‘Set-Cookie’][1];
-
with ExtractVariables policy.
It either only get the JSESSIONID cookie or appears as undefined or null.
In another situation, when it was just one cookie, I did it with ExtractVariables and had no problems.
The three cookies being shown on Postman after the request through Apigee:
Can’t find them on Trace (maybe I’m not looking right…?). I’m also getting a ‘Location’ header on Trace that I don’t know where it is from, but not sure if it is related:
The cookies are set to different domains, could this be an issue? I can only get the first cookie, but I need the others.
Any help is greatly appreciated!!
Thanks in advance.