This commit is contained in:
2025-03-19 10:44:45 +01:00
parent a8a8701739
commit 1b75e89ca4
2 changed files with 8 additions and 4 deletions

View File

@ -7,11 +7,14 @@ export default class CookieManager {
headers?.forEach(header => {
const [cookiePart, ...attributes] = header.split(';').map(part => part.trim());
const [name, value] = cookiePart.split('=');
const cookie = { value: value || "", domain };
const cookie = { value: value || "" };
attributes.forEach(attr => {
const [key, val] = attr.split('=');
const lowerKey = key.toLowerCase();
switch (lowerKey) {
case 'domain':
cookie.domain = val;
break;
case 'path':
cookie.path = val;
break;
@ -38,7 +41,7 @@ export default class CookieManager {
format(domain) {
this.cleanupExpiredCookies();
return Object.entries(this.cookies[domain] || {})
.map(([key, value]) => `${key}=${value.value}`)
.map(([key, value]) => `${key}=${value.value.toString()}`)
.join('; ');
}
getCookies(domain) {