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 摘要。