Returns the appropriate HTTP error for when a function/query doesn't exist. For security reasons, we don't let a non-admin user know what function names exist; so instead of a 404 we return the same 401/403 error as if they didn't have access to it.
(user auth.User, what string, name string)
| 126 | // For security reasons, we don't let a non-admin user know what function names exist; |
| 127 | // so instead of a 404 we return the same 401/403 error as if they didn't have access to it. |
| 128 | func missingError(user auth.User, what string, name string) error { |
| 129 | if user == nil { |
| 130 | return base.HTTPErrorf(http.StatusNotFound, "no such %s %q", what, name) |
| 131 | } else { |
| 132 | return user.UnauthError(base.HTTPErrorf(http.StatusForbidden, "you are not allowed to call %s %q", what, name)) |
| 133 | } |
| 134 | } |
no test coverage detected