mirror of https://github.com/golang-jwt/jwt.git
moved request related error int request subpackage
This commit is contained in:
parent
288cee4336
commit
070a4bdd00
|
@ -8,7 +8,6 @@ import (
|
|||
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")
|
||||
)
|
||||
|
||||
// The errors that might occur when parsing and validating a token
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue