From c5bf0343e8c9dc5a21a546bfc93f24f9fc4d9737 Mon Sep 17 00:00:00 2001
From: David Baker <dave@matrix.org>
Date: Wed, 1 Apr 2015 15:13:14 +0100
Subject: [PATCH] Explain how I justified to myself making JsonResource not
 always send JSON.

---
 synapse/http/server.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/synapse/http/server.py b/synapse/http/server.py
index 76c561d105..0dbdce2839 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -79,6 +79,13 @@ class JsonResource(HttpServer, resource.Resource):
     Resources.
 
     Register callbacks via register_path()
+
+    Callbacks can return a tuple of status code and a dict in which case the
+    the dict will automatically be sent to the client as a JSON object.
+
+    The JsonResource is primarily intended for returning JSON, but callbacks
+    may send something other than JSON, they may do so by using the methods
+    on the request object and instead returning None.
     """
 
     isLeaf = True
-- 
GitLab