fix: Return 405 when setting m.fully_read via account data

The spec requires servers to reject client writes to server-managed
account data types with 405 M_BAD_JSON. We returned 400.
This commit is contained in:
Bardi Harborow authored and Ellis Git committed 2026-11-04 19:32:17 +00:00
1 parent 219e8d2e1e
commit 223e889459
2 files changed
+8 -4

No files matched your search

+1
View File
@@ -0,0 +1 @@
Setting `m.fully_read` via the account data endpoints now returns 405 `M_BAD_JSON` as required by the spec, instead of 400.
+7 -4
View File
@@ -117,10 +117,13 @@ async fn set_account_data(
data: &RawJsonValue,
) -> Result {
if event_type_s == "m.fully_read" {
return Err!(Request(BadJson(
"This endpoint cannot be used for marking a room as fully read (setting \
m.fully_read)"
)));
return Err!(Request(
BadJson(
"This endpoint cannot be used for marking a room as fully read (setting \
m.fully_read)"
),
METHOD_NOT_ALLOWED
));
}
let data: serde_json::Value = serde_json::from_str(data.get())