aio-libs / aio-libs/aiohttp-debugtoolbar

Error when a handler returns something other than a Response

Đang mở
#87 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
202
Fork
29
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.