server
server copied to clipboard
Empty string on no username
Describe the bug When I send a request to /api/auth/register with the following json body:
{
"username": "Hi",
"consent": false
}
I get this error:
{
"code": 50035,
"message": "Invalid Form Body",
"errors": {
"consent": {
"_errors": [
{
"message": "You must agree to the Terms of Service and Privacy Policy.",
"code": "CONSENT_REQUIRED"
}
]
}
}
}
So far, so good. However, if I don't supply a username, like this:
{
"consent": false
}
, the response looks like this:
{
"code": 50035,
"message": "Invalid Form Body",
"errors": {
"": {
"_errors": [
{
"message": "must have required property 'username'",
"code": "required"
}
]
}
}
}
The field under "errors" is just an empty string. Is this supposed to be like that?
System Information (please complete the following information):
- OS: Arch btw
- Node Version: Node v19.9.0
- Python 3 Version: Python 3.10.10
Env and Software info
- Branch (if release is not applicable): main
- Commit Hash: 174d34c376a6a94c88b163cf46f76f2b6e52e633
- Database: SQLite
- Reverse Proxy: n.a.
- Thread Count:
Additional context i hate json i hate json i hate json i hate json i hate json i hate json
for later, the bug is here: https://github.com/spacebarchat/server/blob/1d19db52ebe86d3fcbb8f3837407100e5c15ad73/src/api/util/handlers/route.ts#L100-L116
what should be the error message if not this?
Probably username, to indicate that it is an error with the username. An empty string just doesn't say much about the error