The Go http code calls Header.Add() on your cookie, and Header.Add will
concatenate values together. If you want replacement semantics, you'll have
to clearout the "Set-Cookie" header on the response, or only add your final
cookie.

On Tue, Jul 14, 2020 at 4:58 PM B Carr <buc...@gmail.com> wrote:

> In my application, the most recent cookie value with the same name is
> returned on the next request.
>
> On Tuesday, July 14, 2020 at 1:54:56 PM UTC-6, atd...@gmail.com wrote:
>>
>> Hello,
>>
>> As I am writing some tests, I was wondering what should be the correct
>> behavior when http.SetCookie is called twice with cookies of a same name
>> but different values.
>>
>> For example, what should a user-agent see as the cookie value and hence,
>> what should it return back to the server with the next request?
>>
>> https://play.golang.org/p/nYDmcFcd8Qj
>>
>> Many thanks!
>>
>>
>> --
> 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 golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/442794c0-c906-4472-ba8a-6017a22e19e8o%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/442794c0-c906-4472-ba8a-6017a22e19e8o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29LvaPxnX8y5qEvQV1r1UaUtfWuxZTOL-CNaff%3DeLCwc7SQ%40mail.gmail.com.

Reply via email to