etianen / aiohttp-wsgi

WSGI adapter for aiohttp.
https://aiohttp-wsgi.readthedocs.io
BSD 3-Clause "New" or "Revised" License
232 stars 20 forks source link

Fix RuntimeError in aiohttp #1

Closed jnurmine closed 9 years ago

jnurmine commented 9 years ago

Aiohttp expects a StreamResponse instance in its handle_request, and will fail with a RuntimeError since aiohttp-wsgi currently returns nothing to it:

RuntimeError: Handler <bound method _NotFoundMatchInfo._not_found of {}> should return response instance, got <class 'NoneType'> [middlewares (<function wsgi..middleware_factory at 0x7f42f94d6620>,)]

This change simply returns the StreamResponse used internally to keep aiohttp happy.

Signed-off-by: Slinky slinky@iki.fi

etianen commented 9 years ago

Huh, you're quite right. I'm not sure how I missed that. Did that runtime error recently get introduced into aiohttp?

jnurmine commented 9 years ago

Thanks! Not quite recently, there had been a lot of refactoring but I tracked it down to aiohttp commit d0d6f6ad02f563e6f "Move WebSocketClosed to errors.py, rename it to WebSocketDisconnected, get rid of checking for disconnection in web.RequestHandler", which was committed on January 3rd 2015.

etianen commented 9 years ago

I've just release 0.1.1 with your patch. Thanks!