diff --git a/federationapi/routing/routing.go b/federationapi/routing/routing.go index 649a43c6..645f397d 100644 --- a/federationapi/routing/routing.go +++ b/federationapi/routing/routing.go @@ -18,6 +18,7 @@ import ( "net/http" "github.com/gorilla/mux" + "github.com/matrix-org/dendrite/clientapi/jsonerror" eduserverAPI "github.com/matrix-org/dendrite/eduserver/api" federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api" "github.com/matrix-org/dendrite/internal/config" @@ -203,12 +204,20 @@ func Setup( res := SendJoin( httpReq, request, cfg, rsAPI, keys, roomID, eventID, ) + // not all responses get wrapped in [code, body] + var body interface{} + body = []interface{}{ + res.Code, res.JSON, + } + jerr, ok := res.JSON.(*jsonerror.MatrixError) + if ok { + body = jerr + } + return util.JSONResponse{ Headers: res.Headers, Code: res.Code, - JSON: []interface{}{ - res.Code, res.JSON, - }, + JSON: body, } }, )).Methods(http.MethodPut)