This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new f1c2e09  Only set JSON type if applicable
f1c2e09 is described below

commit f1c2e09131bbd4fdc6fc09169b4354e80a12b83e
Author: Sebb <[email protected]>
AuthorDate: Fri Jun 4 11:02:35 2021 +0100

    Only set JSON type if applicable
---
 server/main.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/main.py b/server/main.py
index 8b8cb0e..3e76209 100644
--- a/server/main.py
+++ b/server/main.py
@@ -121,9 +121,9 @@ class Server(plugins.server.BaseServer):
                     session.database = None
                 if isinstance(output, aiohttp.web.Response):
                     return output
-                headers["content-type"] = "application/json"
                 if output:
                     jsout = await self.runners.run(json.dumps, output, 
indent=2)
+                    headers["content-type"] = "application/json"
                     headers["Content-Length"] = str(len(jsout))
                     return aiohttp.web.Response(headers=headers, status=200, 
text=jsout)
                 return aiohttp.web.Response(

Reply via email to