Skip to content

Commit

Permalink
Fix #2789: Replace can_start() with can_prepare() (#2794)
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Mar 4, 2018
1 parent ca22766 commit 572aeb6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES/2789.bugfix
@@ -0,0 +1 @@
Fix websocket demo.
4 changes: 2 additions & 2 deletions demos/chat/aiohttpdemo_chat/views.py
Expand Up @@ -12,8 +12,8 @@

async def index(request):
resp = web.WebSocketResponse()
ok, protocol = resp.can_start(request)
if not ok:
is_ws = resp.can_prepare(request)
if not is_ws:
return aiohttp_jinja2.render_template('index.html', request, {})

await resp.prepare(request)
Expand Down
4 changes: 2 additions & 2 deletions tests/autobahn/server.py
Expand Up @@ -8,8 +8,8 @@

async def wshandler(request):
ws = web.WebSocketResponse(autoclose=False)
ok, protocol = ws.can_start(request)
if not ok:
is_ws = ws.can_prepare(request)
if not is_ws:
return web.HTTPBadRequest()

await ws.prepare(request)
Expand Down

0 comments on commit 572aeb6

Please sign in to comment.