Skip to content

Instantly share code, notes, and snippets.

@mittsh
Last active October 20, 2020 08:42
Show Gist options
  • Save mittsh/57a21547f469df67edd8a8cfa6be27f3 to your computer and use it in GitHub Desktop.
Save mittsh/57a21547f469df67edd8a8cfa6be27f3 to your computer and use it in GitHub Desktop.
function filterCookies(name, responseCookies) {
var cookies = responseCookies.split(/[,;]/)
cookies = cookies.filter(function(keyValue) {
var aName = keyValue.split('=')[0];
return name === aName;
});
return cookies.join(',');
};
function evaluate(context) {
// write here the cookie name you want to filter
var name = 'exampleCookieName';
// get all cookies from a response
// @TODO put here a "Response Cookie" dynamic value
var responseCookies = "{Response Cookie Dynamic Value}";
return filterCookies(name, responseCookies);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment