mirror of
https://github.com/wahyd4/loginsrv.git
synced 2026-08-09 04:46:29 +10:00
Add additional cookie validations
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user