fetch merges multiple "set-cookie" headers into one string

There are three separate Set-Cookie in the response header. Each one of them has different key-value pairs in it.
However, when I do response.headers.get('Set-Cookie') that merges all three Set-Cookie values into one big string and I can’t parse them by ; anymore.

fetch(url, {
    headers: {
      'Content-Type': 'application/json'
    cache: 'no-cache'
  then(response => {
    headers = response.headers.get('Set-Cookie')
    return response.json()

This could be a pure javascript error but I’m not sure cause I can’t iterate through response.headers. It returns fuse objects.

Please post a complete reproduction that one could run. Unfortunately there’s not much we can help with, because we don’t know what headers your url there returns.

I added this line in the response block:


and tested with a random JSON API. I see that the headers are just a plain object, and I do not think that JSON objects allow several properties have the same name. You’re likely mixing something up.


Please find it below. As you can see, there is only one “Set-Cookie” in the header and the values are merged. My-service and AWSELB should have separated by ; .

         "Thu, 01 Jan 1970 00:00:00 GMT"
         "CONDITIONAL_CACHE 200"
         "Tue, 05 Sep 2017 15:23:35 GMT"
         "nginx/1.10.3 (Ubuntu)"
         "HTTP/1.1 200 OK"

Have you tried debugging what cookie string your backend sends? Is the “merging” behaviour specific to Fuse, or does, for example, a browser receive the same?

And again, please provide a complete reproduction that we could run.