1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 07:19:41 +02:00

feat(api): replace all calls to http.Error with custom Error writer

This commit is contained in:
Anthony Lapenna 2017-01-24 16:35:48 +13:00
parent 1a868be6ea
commit d03e992b4f
4 changed files with 10 additions and 11 deletions

View file

@ -47,13 +47,13 @@ func (service *middleWareService) middleWareAuthenticate(next http.Handler) http
}
if token == "" {
http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
Error(w, portainer.ErrUnauthorized, http.StatusUnauthorized, nil)
return
}
err := service.jwtService.VerifyToken(token)
if err != nil {
http.Error(w, err.Error(), http.StatusUnauthorized)
Error(w, err, http.StatusUnauthorized, nil)
return
}