From c6b12ab7548eef1190ea486a5fe9980aecca5f74 Mon Sep 17 00:00:00 2001 From: Wing Gao Date: Fri, 15 Dec 2017 22:42:18 +0800 Subject: [PATCH] need a better way to replace an existed cookie Former-commit-id: bee4a686d50e61e607e7f86c1dee93a877cd1413 --- sessions/cookie.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sessions/cookie.go b/sessions/cookie.go index d95de513..537f8d19 100644 --- a/sessions/cookie.go +++ b/sessions/cookie.go @@ -53,6 +53,11 @@ func RemoveCookie(ctx context.Context, name string, purge bool) { c.Value = "" c.Path = "/" AddCookie(ctx, c, purge) + + if purge { + // delete request's cookie also, which is temporary available. + ctx.Request().Header.Set("Cookie", "") + } } // IsValidCookieDomain returns true if the receiver is a valid domain to set