Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix request path; #52

Merged
merged 4 commits into from
Oct 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aiohttp_debugtoolbar/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def setup(app, **kw):
app.router.add_route('GET', path_prefix + '/sse', views.sse,
name='debugtoolbar.sse')

app.router.add_route('GET', path_prefix + '/_debugtoolbar/{request_id}',
app.router.add_route('GET', path_prefix + '/{request_id}',
views.request_view, name='debugtoolbar.request')
app.router.add_route('GET', path_prefix, views.request_view,
name='debugtoolbar.main')
Expand Down
23 changes: 13 additions & 10 deletions aiohttp_debugtoolbar/panels/request_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ def process_response(self, response):
request = self.request
yield from request.post()
data.update({
'get': [(k, request.GET.getall(k)) for k in request.GET],
'post': [(k, saferepr(v)) for k, v in request.POST.items()],
'cookies': [(k, request.cookies.get(k)) for k in request.cookies],
'attrs': [(k, v) for k, v in request.items()],
'get': [(k, request.GET.getall(k)) for k in sorted(request.GET)],
'post': [(k, saferepr(request.POST.getall(k)))
for k in sorted(request.POST)],
'cookies': [(k, v) for k, v in sorted(request.cookies.items())],
'attrs': [(k, v) for k, v in sorted(request.items())],
})
# TODO: think about adding aiohttp_sessions support as separate table
# and maybe aiohttp_security

# if hasattr(request, 'session'):
# data.update({
# 'session': dictrepr(request.session),
# })
# TODO: think about aiohttp_security

# session to separate table
session = request.get('aiohttp_session')
if session and not session.empty:
data.update({
'session': [(k, v) for k, v in sorted(session.items())],
})
12 changes: 10 additions & 2 deletions aiohttp_debugtoolbar/panels/templates/headers.jinja2
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<h4>Request Headers</h4>
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Key</th>
Expand All @@ -10,14 +14,18 @@
{% for key, value in request_headers %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td>{{ value }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>

<h4>Response Headers</h4>
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Key</th>
Expand All @@ -28,7 +36,7 @@
{% for key, value in response_headers %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td>{{ value }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down
22 changes: 17 additions & 5 deletions aiohttp_debugtoolbar/panels/templates/request_vars.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{% for key, value in cookies %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td>{{ value }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
Expand All @@ -41,7 +41,7 @@
{% for key, value in session %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td>{{ value }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
Expand All @@ -53,6 +53,10 @@
<h4>GET Variables</h4>
{% if get %}
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Variable</th>
Expand All @@ -63,7 +67,7 @@
{% for key, value in get %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td>{{ ', '.join(value) }}</td>
<td class="value">{{ ', '.join(value) }}</td>
</tr>
{% endfor %}
</tbody>
Expand All @@ -75,6 +79,10 @@
<h4>POST Variables</h4>
{% if post %}
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Variable</th>
Expand All @@ -85,7 +93,7 @@
{% for key, value in post %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td>{{ value }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
Expand All @@ -97,6 +105,10 @@
<h4>Request attributes</h4>
{% if attrs %}
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Attribute</th>
Expand All @@ -107,7 +119,7 @@
{% for key, value in attrs %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td>{{ value }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down
5 changes: 5 additions & 0 deletions aiohttp_debugtoolbar/static/css/debugger.css
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,8 @@ div.sourceview span.current {
width: 100%;
background-color: #ddd;
}

td.value {
word-break: break-all;
word-wrap: break-word;
}