diff --git a/errors.go b/errors.go index b055f3b..6a60e91 100644 --- a/errors.go +++ b/errors.go @@ -6,9 +6,8 @@ import ( // Error constants var ( - ErrInvalidKey = errors.New("key is invalid or of invalid type") - ErrHashUnavailable = errors.New("the requested hash function is unavailable") - ErrNoTokenInRequest = errors.New("no token present in request") + ErrInvalidKey = errors.New("key is invalid or of invalid type") + ErrHashUnavailable = errors.New("the requested hash function is unavailable") ) // The errors that might occur when parsing and validating a token diff --git a/request/request.go b/request/request.go index c1ba852..c812488 100644 --- a/request/request.go +++ b/request/request.go @@ -1,11 +1,17 @@ package request import ( + "errors" "github.com/dgrijalva/jwt-go" "net/http" "strings" ) +// Errors +var ( + ErrNoTokenInRequest = errors.New("no token present in request") +) + // Try to find the token in an http.Request. // This method will call ParseMultipartForm if there's no token in the header. // Currently, it looks in the Authorization header as well as @@ -29,5 +35,5 @@ func ParseFromRequestWithClaims(req *http.Request, keyFunc jwt.Keyfunc, claims j return jwt.ParseWithClaims(tokStr, keyFunc, claims) } - return nil, jwt.ErrNoTokenInRequest + return nil, ErrNoTokenInRequest }