Add additional cookie validations

This commit is contained in:
magikstm
2017-11-09 01:22:30 -05:00
parent 4309067e07
commit 36363aaae3
+9 -1
View File
@@ -47,9 +47,17 @@ func Test_ServeHTTP_200(t *testing.T) {
}
//Set cookie for user token on the ServeHTTP http.ResponseWriter
cookie := http.Cookie{Name: "jwt_token",Value: validToken}
http.SetCookie(w, &cookie)
//Add the cookie to the request
r.AddCookie(&cookie)
//Test that cookie is a valid token
_ ,valid := loginh.GetToken(r)
if !valid {
t.Errorf("loginHandler cookie is not valid")
}
status, err := h.ServeHTTP(w, r)
if err != nil {