aio-libs / aio-libs/aiohttp-debugtoolbar

Error when a handler returns something other than a Response

未關閉
#87 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
202
分支
29
PR 合併指標
30 天內沒有已合併 PR

描述

currently

```python
# @template('index.jinja')
async def index(request):
return {
'foo': 'bar'
}
```

will give cause an error in `aiohttp-debugtoolbar`:

```
Traceback (most recent call last):
File "/home/samuel/code/purge_cloudflare/env/lib/python3.5/site-packages/aiohttp/web_server.py", line 61, in handle_request
resp = yield from self._handler(request)
File "/home/samuel/code/purge_cloudflare/env/lib/python3.5/site-packages/aiohttp/web.py", line 249, in _handle
resp = yield from handler(request)
File "/home/samuel/code/purge_cloudflare/env/lib/python3.5/site-packages/aiohttp_debugtoolbar/middlewares.py", line 122, in toolbar_middleware
toolbar.status = response.status
AttributeError: 'dict' object has no attribute 'status'
```

instead I guess debug toolbar should show the
```
AssertionError: Handler should return response instance, got [middlewares []]
```

as it does for standard exceptions occurring in a handler.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。