Skip to content
This repository was archived by the owner on Oct 31, 2019. It is now read-only.
Open
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
7 changes: 5 additions & 2 deletions devtools/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
from pathlib import Path

import aiohttp
from aiohttp.web import Application, HTTPBadGateway, Response, WebSocketResponse, WSMsgType, hdrs, json_response
from aiohttp.hdrs import istr
from aiohttp.web import Application, HTTPBadGateway, Response, WebSocketResponse, WSMsgType, json_response

from devtools import VERSION

CONTENT_LENGTH = istr('CONTENT-LENGTH')

with_ujson = os.environ.get('DTP_UJSON', '').lower() == 'true'
if with_ujson:
import ujson as json
Expand Down Expand Up @@ -191,7 +194,7 @@ async def proxy_handler(request):
else:
log_msg('[WARN]', f'JSON data neither list nor dict: {data}')
body, text = None, json.dumps(data)
headers[hdrs.CONTENT_LENGTH] = str(len(text))
headers[CONTENT_LENGTH] = str(len(text))
else:
body, text = await response.read(), None

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp==2.3.10
aiohttp==3.2.1
cchardet==2.1.1
ujson==1.35
uvloop==0.9.1; sys_platform != 'win32'