mirror of
https://github.com/labstack/echo.git
synced 2024-11-24 08:22:21 +02:00
Add JWT tests for _query_ method
This commit is contained in:
parent
4b6811e0cf
commit
bb6baa2088
@ -60,6 +60,41 @@ func TestJWT(t *testing.T) {
|
||||
expErrCode: http.StatusBadRequest,
|
||||
info: "Empty header auth field",
|
||||
},
|
||||
{
|
||||
config: JWTConfig{
|
||||
SigningKey: validKey,
|
||||
TokenLookup: "query:jwt",
|
||||
},
|
||||
reqURL: "/?a=b&jwt=" + token,
|
||||
info: "Valid query method",
|
||||
},
|
||||
{
|
||||
config: JWTConfig{
|
||||
SigningKey: validKey,
|
||||
TokenLookup: "query:jwt",
|
||||
},
|
||||
reqURL: "/?a=b&jwtxyz=" + token,
|
||||
expErrCode: http.StatusBadRequest,
|
||||
info: "Invalid query param name",
|
||||
},
|
||||
{
|
||||
config: JWTConfig{
|
||||
SigningKey: validKey,
|
||||
TokenLookup: "query:jwt",
|
||||
},
|
||||
reqURL: "/?a=b&jwt=invalid-token",
|
||||
expErrCode: http.StatusUnauthorized,
|
||||
info: "Invalid query param value",
|
||||
},
|
||||
{
|
||||
config: JWTConfig{
|
||||
SigningKey: validKey,
|
||||
TokenLookup: "query:jwt",
|
||||
},
|
||||
reqURL: "/?a=b",
|
||||
expErrCode: http.StatusBadRequest,
|
||||
info: "Empty query",
|
||||
},
|
||||
} {
|
||||
|
||||
if tc.reqURL == "" {
|
||||
|
Loading…
Reference in New Issue
Block a user