Fix failing tests

This commit is contained in:
Till Faelligen 2021-08-28 14:30:59 +02:00
parent 937f72b250
commit 66b65fdd27
9 changed files with 46 additions and 21 deletions

View file

@ -70,11 +70,11 @@ func VerifyUserFromRequest(
jsonErr := jsonerror.InternalServerError()
return nil, &jsonErr
}
if res.Err != nil {
if forbidden, ok := res.Err.(*api.ErrorForbidden); ok {
if res.Err != "" {
if strings.HasPrefix(strings.ToLower(res.Err), "forbidden:") { // TODO: use actual error and no string comparison
return nil, &util.JSONResponse{
Code: http.StatusForbidden,
JSON: jsonerror.Forbidden(forbidden.Message),
JSON: jsonerror.Forbidden(res.Err),
}
}
}