gigebyte / cookies

Automatically exported from code.google.com/p/cookies
0 stars 0 forks source link

Add JSON support #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Look into, and add if possible,:
1. Determining if JSON support is available (sniff for JSON object)
2. If 1, allow any JS value to be passed to set(), JSON encode it, and write it 
to cookie source
3. If 1, when reading cookies, determine if value is JSON encoded and decode it 
before returning

Original issue reported on code.google.com by auldrid...@gmail.com on 19 Dec 2009 at 3:59

GoogleCodeExporter commented 9 years ago
Added in r39

When setting cookie, if value is non-string and JSON support is found, value 
will be JSON stringified.  If non-
string is passed and JSON support is not found, an Error will be thrown.

Cookie parsing will always attempt JSON decode inside of a try, catch will 
simply return value as is for things 
which were not JSON encoded.  This is not 100% satisfactory, but it is working.

If anyone has suggestions for a better approach, please contact me to 
discuss--I'd love to hear it.

Original comment by auldrid...@gmail.com on 20 Dec 2009 at 7:27

GoogleCodeExporter commented 9 years ago

Original comment by auldrid...@gmail.com on 27 Jan 2011 at 7:00