Working with the set-cookie Header

Trying to work with header values is somewhat tricky. In my current project, we need to filter the values inside the set-cookie response header. However, as Apigee just splits header values by comma, certain attributes such as "expires" (e.g. Expires=Thu, 01 Jan 1970...) can cause headaches here, resulting in a separate header/cookie value where there should be none.

The Apigee variables reference lists the "message.header.header_name.values" field as type collection. Are the values in that field separated by commas as well? If not, how does this translate to Javascript? When importing the variable it's merely an object and I haven't found a way to cast it to something iterable.

It would be great to have a reliable method of separating header values which doesn't involved dodgy custom regexes. Browsers are able to tokenize the set-cookie header correctly, after all.

0 1 233
1 REPLY 1

Try message.header.header_name.values.string .  It does not tokenize, it just gives you back the entire header.