@@ -84,6 +84,8 @@ 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 " },
8789 }
8890
8991 for _ , tc := range tt {
@@ -93,7 +95,7 @@ func TestSimple(t *testing.T) {
9395 }
9496 status , resp := testRequest (t , ts , "GET" , "/" , h , nil )
9597 if status != tc .Status || resp != tc .Resp {
96- t .Fatalf ("test '%s' failed: expected status %d, got %d" , tc .Name , tc .Status , status )
98+ t .Errorf ("test '%s' failed: expected Status: %d %q , got %d %q " , tc .Name , tc .Status , tc . Resp , status , resp )
9799 }
98100 }
99101}
0 commit comments