add version and translate all pages
This commit is contained in:
@@ -311,7 +311,7 @@ func TestResolveUser(t *testing.T) {
|
||||
t.Errorf("resolve: %+v", env.Data)
|
||||
}
|
||||
// Jamais email ni is_admin
|
||||
if len(rec.Body.Bytes()) < 0 || strings.Contains(rec.Body.String(), "is_admin") || strings.Contains(rec.Body.String(), "email") {
|
||||
if len(rec.Body.Bytes()) == 0 || strings.Contains(rec.Body.String(), "is_admin") || strings.Contains(rec.Body.String(), "email") {
|
||||
t.Error("resolve ne doit pas exposer email/is_admin")
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
@@ -47,10 +46,3 @@ func RegisterRoutes(r *gin.Engine) {
|
||||
api.Error(c, http.StatusNotFound, "NOT_FOUND", "route not found")
|
||||
})
|
||||
}
|
||||
|
||||
// userID lit la clé de scoping posée par RequireAuth. Un empty string est
|
||||
// impossible en conditions normales (le middleware l'a validé) ; garde-fou
|
||||
// pour un appel direct dans les tests.
|
||||
func userID(c *gin.Context) string {
|
||||
return strings.TrimSpace(c.GetString(UserIDKey))
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func writeError(c *gin.Context, err error) {
|
||||
api.Error(c, 404, "GRANTEE_NOT_FOUND", "the specified user does not exist")
|
||||
case errors.Is(err, repository.ErrNameConflict):
|
||||
api.Error(c, 409, "NAME_CONFLICT", "a resource with this name already exists here")
|
||||
case errors.Is(err, service.FileTooLargeError):
|
||||
case errors.Is(err, service.ErrFileTooLarge):
|
||||
api.Error(c, 413, "FILE_TOO_LARGE", "file exceeds the maximum allowed size")
|
||||
default:
|
||||
api.Error(c, 500, "INTERNAL", err.Error())
|
||||
|
||||
Reference in New Issue
Block a user