You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/09/07 13:24:13 UTC
[incubator-ponymail-foal] branch humbedooh/mbox-stream updated:
pass request object to streaming responses so that they may prepare
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch humbedooh/mbox-stream
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/humbedooh/mbox-stream by this push:
new 2b39d8c pass request object to streaming responses so that they may prepare
2b39d8c is described below
commit 2b39d8c767afb1fb6d04273272218fb76df13c5d
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Sep 7 08:24:11 2021 -0500
pass request object to streaming responses so that they may prepare
---
server/main.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/server/main.py b/server/main.py
index 3e76209..a0d6ab5 100644
--- a/server/main.py
+++ b/server/main.py
@@ -114,12 +114,15 @@ class Server(plugins.server.BaseServer):
# Wait for endpoint response. This is typically JSON in case of success,
# but could be an exception (that needs a traceback) OR
# it could be a custom response, which we just pass along to the client.
- output = await self.handlers[handler].exec(self, session, indata)
+ if isinstance(handler, plugins.server.StreamingEndpoint):
+ output = await handler.exec(self, request, session, indata)
+ elif isinstance(handler, plugins.server.Endpoint):
+ output = await handler.exec(self, session, indata)
if session.database:
self.dbpool.put_nowait(session.database)
self.dbpool.task_done()
session.database = None
- if isinstance(output, aiohttp.web.Response):
+ if isinstance(output, aiohttp.web.Response) or isinstance(output, aiohttp.web.StreamResponse):
return output
if output:
jsout = await self.runners.run(json.dumps, output, indent=2)