I'm trying to create manual browser cookie emulation using Node.js.
Basically I have two strings, once containing the current cookie and the other containing new or updated values to be added to the cookie. I want to update the old string with the new one by replacing or adding values. How can I achieve this via javascript?
For example:
PREF=ID=2191324fe41c6152:FF=0:TM=1320223272:LM=1320223272:S=H6-vdbEpgEzHAknb;
Foo=kfjaofjiof382f3gio;
expires=Fri, 01-Nov-2013 08:41:12 GMT; path=/; HTTPonly;
Is updated with
PREF=ID=435:FF=2:TM=1320223272:LM=1320223272:S=zzHAknb; Name=23;
expires=Fri, 01-Nov-2013 08:41:12 GMT; path=/; HTTPonly;
Returns
PREF=ID=435:FF=2:TM=1320223272:LM=1320223272:S=zzHAknb; Name=23;
Foo=kfjaofjiof382f3gio;
expires=Fri, 01-Nov-2013 08:41:12 GMT; path=/; HTTPonly;