Bereaksi Cookie Ekstrak Asli dari Respons

// 'headers' is iterable
const get_set_cookies = function(headers) {
    const set_cookies = []
    for (const [name, value] of headers) {
        if (name === "set-cookie") {
            set_cookies.push(value)
        }
    }
    return set_cookies
}

fetch(url, {
    method: "POST",
    credentials: "same-origin", // or 'include' depending on CORS
    // ...
})
.then(response => {
    const set_cookies = get_set_cookies(response.headers)
})
Arrogant Alligator