Description
Extracted from #2081
To reproduce
- In the web UI, try to invite a user that doesn't exist in crates.io's database, like
ghost
. - The UI will display "An invite has been sent to ghost".
If you inspect the network request that happens when the invite is submitted, the backend returns:
{"errors":[{"detail":"could not find user with login `ghost`"}]}
The expected behavior is that the error is displayed in the frontend.
To fix
This code looks like it should be displaying errors, but it's not and I'm not entirely sure why. One guess I have is that the status code returned is 200 because that's what (old versions of?) Cargo expects even if there's an error.
Because the response is nonstandard, we might have to do something nonstandard to handle it, perhaps like the login router does?
We do have a test for this, which is passing incorrectly, because the mirage configuration is returning a different response than the backend is. The mirage configuration needs to be updated to return status 200 but with the errors
JSON.