mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
Return the correct error codes for v6 invite JSON violations (#1440)
* Return the correct error codes for v6 invite JSON violations * Update sytest-whitelist
This commit is contained in:
parent
3013ade84f
commit
6fbf89a166
3 changed files with 28 additions and 4 deletions
|
@ -138,7 +138,14 @@ func SendLeave(
|
|||
|
||||
// Decode the event JSON from the request.
|
||||
event, err := gomatrixserverlib.NewEventFromUntrustedJSON(request.Content(), verRes.RoomVersion)
|
||||
if err != nil {
|
||||
switch err.(type) {
|
||||
case gomatrixserverlib.BadJSONError:
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.BadJSON(err.Error()),
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.NotJSON("The request body could not be decoded into valid JSON. " + err.Error()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue