summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2021-08-04 16:13:24 +0200
committerGitHub <noreply@github.com>2021-08-04 16:13:24 +0200
commite8a3e8140291be0548ad80d0e942a9aaae6c2434 (patch)
tree54102a62409ce7560da0772e5247ed0629246bf5 /tests
parentFix PeriodicallyFlushingMemoryHandler inhibiting application shutdown (#10517) (diff)
downloadsynapse-e8a3e8140291be0548ad80d0e942a9aaae6c2434.tar.xz
Don't fail on empty bodies when sending out read receipts (#10531)
Fixes a bug introduced in rc1 that would cause Synapse to 400 on read receipts requests with empty bodies.

Broken in #10413
Diffstat (limited to 'tests')
-rw-r--r--tests/rest/client/v2_alpha/test_sync.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/rest/client/v2_alpha/test_sync.py b/tests/rest/client/v2_alpha/test_sync.py
index f6ae9ae181..15748ed4fd 100644
--- a/tests/rest/client/v2_alpha/test_sync.py
+++ b/tests/rest/client/v2_alpha/test_sync.py
@@ -418,6 +418,18 @@ class ReadReceiptsTestCase(unittest.HomeserverTestCase):
         # Test that the first user can't see the other user's hidden read receipt
         self.assertEqual(self._get_read_receipt(), None)
 
+    def test_read_receipt_with_empty_body(self):
+        # Send a message as the first user
+        res = self.helper.send(self.room_id, body="hello", tok=self.tok)
+
+        # Send a read receipt for this message with an empty body
+        channel = self.make_request(
+            "POST",
+            "/rooms/%s/receipt/m.read/%s" % (self.room_id, res["event_id"]),
+            access_token=self.tok2,
+        )
+        self.assertEqual(channel.code, 200)
+
     def _get_read_receipt(self):
         """Syncs and returns the read receipt."""