@@ -1064,3 +1064,47 @@ func TestAjaxForbiddendRequest(t *testing.T) {
10641064 mime := rh.Get("Content-Type")
10651065 assert.NotEqual(t, applicationJSON, mime)
10661066}
1067+
1068+func TestClearSplitCookie(t *testing.T) {
1069+ p := OAuthProxy{CookieName: "oauth2", CookieDomain: "abc"}
1070+ var rw = httptest.NewRecorder()
1071+ req := httptest.NewRequest("get", "/", nil)
1072+
1073+ req.AddCookie(&http.Cookie{
1074+ Name: "test1",
1075+ Value: "test1",
1076+ })
1077+ req.AddCookie(&http.Cookie{
1078+ Name: "oauth2_0",
1079+ Value: "oauth2_0",
1080+ })
1081+ req.AddCookie(&http.Cookie{
1082+ Name: "oauth2_1",
1083+ Value: "oauth2_1",
1084+ })
1085+
1086+ p.ClearSessionCookie(rw, req)
1087+ header := rw.Header()
1088+
1089+ assert.Equal(t, 2, len(header["Set-Cookie"]), "should have 3 set-cookie header entries")
1090+}
1091+
1092+func TestClearSingleCookie(t *testing.T) {
1093+ p := OAuthProxy{CookieName: "oauth2", CookieDomain: "abc"}
1094+ var rw = httptest.NewRecorder()
1095+ req := httptest.NewRequest("get", "/", nil)
1096+
1097+ req.AddCookie(&http.Cookie{
1098+ Name: "test1",
1099+ Value: "test1",
1100+ })
1101+ req.AddCookie(&http.Cookie{
1102+ Name: "oauth2",
1103+ Value: "oauth2",
1104+ })
1105+
1106+ p.ClearSessionCookie(rw, req)
1107+ header := rw.Header()
1108+
1109+ assert.Equal(t, 1, len(header["Set-Cookie"]), "should have 1 set-cookie header entries")
1110+}