I am trying to follow this answer, but it doesn't seem to work for me. In the request to https://https.api.pqr.com/folder/ I can see all the cookies still present.
Here is the code:
chrome.cookies.getAll({domain: ".pqr.com"}, async function(cookies) {
for(var i = 0; i < cookies.length; i++) {
try {
console.log(cookies[i], "to remove");
chrome.cookies.remove({url: "http://" + cookies[i].domain + cookies[i].path, name: cookies[i].name});
console.log(cookies[i], "removed");
} catch (ex) {
console.log(cookies[i], ex);
}
try {
console.log(cookies[i], "to remove");
chrome.cookies.remove({url: "https://" + cookies[i].domain + cookies[i].path, name: cookies[i].name});
console.log(cookies[i], "removed");
} catch (ex) {
console.log(cookies[i], ex);
}
}
const resp = await fetch("https://https.api.pqr.com/folder/", {
method: "POST",
signal: params.signal,
body: JSON.stringify({
userInput: "someval,
}),
headers: {
"Content-Type": "application/json;charset=UTF-8",
"Accept-Language": "en-US,en;q=0.9",
"Cookie": ''
},
});
});