Got some insight about this from Rog Peppe.  The problem seems to step from 
the fact that the String() method on http.Cookie does different things 
based on what values are set in the cookie.  If it's just Name and Value, 
then String() returns a value suitable for a Cookie header (i.e. what you'd 
send up with a web request).  If other values (like Domain) are set, then 
String() returns the Set-Cookie header (like what you'd get from a 
website).  Since the Cookies(url) method is intended to be used for getting 
cookies to send with a web request, it strips out everything except Name 
and Value, so that String() returns the right format.

Thus, you *can't* round trip from SetCookie to GetCookies and back to 
SetCookie.  Which is really unfortunate, but not something that can be 
fixed in the go1 timeframe.

On Tuesday, October 4, 2016 at 9:23:43 PM UTC-4, Nate Finch wrote:
>
> See here: https://play.golang.org/p/E4_8NiodmK
>
> Is this intended? The cookies returned from cookiejar.Jar.Cookies() don't 
> include the domain, which is part of the key that they're stored under, so 
> they're no longer "the same" cookies.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to