loginsrv

Unnamed repository; edit this file 'description' to name the repository.
git clone git@jamesshield.xyz:repos/loginsrv.git
Log | Files | Refs | README | LICENSE

commit 36363aaae3797b8178e1dcde55fdc0d02ade8777
parent 4309067e07df9d6eceec0913a9ec0a219b791eb0
Author: magikstm <myskina@gmail.com>
Date:   Thu,  9 Nov 2017 01:22:30 -0500

Add additional cookie validations

Diffstat:
Mcaddy/handler_test.go | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/caddy/handler_test.go b/caddy/handler_test.go @@ -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 {