Skip to content

Commit

Permalink
Initial alias of response object
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Nov 13, 2019
1 parent 18cc716 commit 50903f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/appier/asgi.py
Expand Up @@ -97,8 +97,8 @@ def serve_daphne(self, host, port, **kwargs):
self._server.run()

async def send(self, data, content_type = None):
if content_type: self.request.set_content_type(content_type)
return await self.request.send(data)
if content_type: self.response.set_content_type(content_type)
return await self.response.send(data)

async def app_asgi(self, *args, **kwargs):
return await self.application_asgi(*args, **kwargs)
Expand Down
4 changes: 4 additions & 0 deletions src/appier/base.py
Expand Up @@ -482,6 +482,10 @@ def request_ctx(self):
if not self._request_ctx: return None
return self._request_ctx.get(None)

@property
def response(self):
return self.request

@property
def locale(self):
if not self.request: return None
Expand Down

0 comments on commit 50903f3

Please sign in to comment.