Change generateSetCookieHeader to callback