@@ -84,6 +84,9 @@ func TestSimple(t *testing.T) {
8484 {Name : "valid BEARER" , Authorization : "BEARER " + newJwtToken (TokenSecret ), Status : 200 , Resp : "welcome" },
8585 {Name : "valid bearer" , Authorization : "bearer " + newJwtToken (TokenSecret ), Status : 200 , Resp : "welcome" },
8686 {Name : "valid claim" , Authorization : "Bearer " + newJwtToken (TokenSecret , map [string ]interface {}{"service" : "test" }), Status : 200 , Resp : "welcome" },
87+ {Name : "invalid bearer_" , Authorization : "BEARER_" + newJwtToken (TokenSecret ), Status : 401 , Resp : "token is unauthorized\n " },
88+ {Name : "invalid bearerx" , Authorization : "BEARERx" + newJwtToken (TokenSecret ), Status : 401 , Resp : "token is unauthorized\n " },
89+ {Name : "invalid bearer " , Authorization : "BEARER " + newJwtToken (TokenSecret ), Status : 401 , Resp : "token is unauthorized\n " },
8790 }
8891
8992 for _ , tc := range tt {
@@ -93,7 +96,7 @@ func TestSimple(t *testing.T) {
9396 }
9497 status , resp := testRequest (t , ts , "GET" , "/" , h , nil )
9598 if status != tc .Status || resp != tc .Resp {
96- t .Fatalf ("test '%s' failed: expected status %d, got %d" , tc .Name , tc .Status , status )
99+ t .Errorf ("test '%s' failed: expected status %d, got %d" , tc .Name , tc .Status , status )
97100 }
98101 }
99102}
0 commit comments