[Trivial] Remove duplicate work
Move the cookie serialization code into cookie
Merge pull request #690 from BoapNet/fix-cookies2

[Trivial] Small refactoring