mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 23:48:27 +00:00
Do not wrap send_join errors on /v1/send_join (#1143)
* Do not wrap v1 send_join errors in [code, body] * Don't wrap errors
This commit is contained in:
parent
c4d9b37492
commit
38053a5bb7
1 changed files with 12 additions and 3 deletions
|
@ -18,6 +18,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
"github.com/matrix-org/dendrite/clientapi/jsonerror"
|
||||||
eduserverAPI "github.com/matrix-org/dendrite/eduserver/api"
|
eduserverAPI "github.com/matrix-org/dendrite/eduserver/api"
|
||||||
federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api"
|
federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api"
|
||||||
"github.com/matrix-org/dendrite/internal/config"
|
"github.com/matrix-org/dendrite/internal/config"
|
||||||
|
@ -203,12 +204,20 @@ func Setup(
|
||||||
res := SendJoin(
|
res := SendJoin(
|
||||||
httpReq, request, cfg, rsAPI, keys, roomID, eventID,
|
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{
|
return util.JSONResponse{
|
||||||
Headers: res.Headers,
|
Headers: res.Headers,
|
||||||
Code: res.Code,
|
Code: res.Code,
|
||||||
JSON: []interface{}{
|
JSON: body,
|
||||||
res.Code, res.JSON,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)).Methods(http.MethodPut)
|
)).Methods(http.MethodPut)
|
||||||
|
|
Loading…
Reference in a new issue