@@ -84,6 +84,9 @@ func TestSimple(t *testing.T) {
84
84
{Name : "valid BEARER" , Authorization : "BEARER " + newJwtToken (TokenSecret ), Status : 200 , Resp : "welcome" },
85
85
{Name : "valid bearer" , Authorization : "bearer " + newJwtToken (TokenSecret ), Status : 200 , Resp : "welcome" },
86
86
{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 " },
87
90
}
88
91
89
92
for _ , tc := range tt {
@@ -93,7 +96,7 @@ func TestSimple(t *testing.T) {
93
96
}
94
97
status , resp := testRequest (t , ts , "GET" , "/" , h , nil )
95
98
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 )
97
100
}
98
101
}
99
102
}
0 commit comments