aboutsummaryrefslogtreecommitdiff
path: root/clientapi/httputil
diff options
context:
space:
mode:
authordevonh <devon.dmytro@gmail.com>2023-05-09 22:46:49 +0000
committerGitHub <noreply@github.com>2023-05-09 22:46:49 +0000
commit0489d16f95a3d9f1f5bc532e2060bd2482d7b156 (patch)
treea0573b5a0c21ca563e97abae81e36d66ad14e7d8 /clientapi/httputil
parenta49c9f01e227aeb12aa2f27d5bf1915453c23a3b (diff)
Move json errors over to gmsl (#3080)
Diffstat (limited to 'clientapi/httputil')
-rw-r--r--clientapi/httputil/httputil.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/clientapi/httputil/httputil.go b/clientapi/httputil/httputil.go
index 74f84f1e..aea0c3db 100644
--- a/clientapi/httputil/httputil.go
+++ b/clientapi/httputil/httputil.go
@@ -20,7 +20,7 @@ import (
"net/http"
"unicode/utf8"
- "github.com/matrix-org/dendrite/clientapi/jsonerror"
+ "github.com/matrix-org/gomatrixserverlib/spec"
"github.com/matrix-org/util"
)
@@ -32,7 +32,7 @@ func UnmarshalJSONRequest(req *http.Request, iface interface{}) *util.JSONRespon
body, err := io.ReadAll(req.Body)
if err != nil {
util.GetLogger(req.Context()).WithError(err).Error("io.ReadAll failed")
- resp := jsonerror.InternalServerError()
+ resp := spec.InternalServerError()
return &resp
}
@@ -43,7 +43,7 @@ func UnmarshalJSON(body []byte, iface interface{}) *util.JSONResponse {
if !utf8.Valid(body) {
return &util.JSONResponse{
Code: http.StatusBadRequest,
- JSON: jsonerror.NotJSON("Body contains invalid UTF-8"),
+ JSON: spec.NotJSON("Body contains invalid UTF-8"),
}
}
@@ -53,7 +53,7 @@ func UnmarshalJSON(body []byte, iface interface{}) *util.JSONResponse {
// valid JSON with incorrect types for values.
return &util.JSONResponse{
Code: http.StatusBadRequest,
- JSON: jsonerror.BadJSON("The request body could not be decoded into valid JSON. " + err.Error()),
+ JSON: spec.BadJSON("The request body could not be decoded into valid JSON. " + err.Error()),
}
}
return nil