fix regressions in last two commits

lol too lazy to rebase
This commit is contained in:
Kay Faraday 2021-09-08 03:44:01 +00:00
parent 72de283a8d
commit f5f3c45494
1 changed files with 2 additions and 1 deletions

3
app.py
View File

@ -26,7 +26,7 @@ def load_config():
host['pattern'] = re.compile(host['pattern'].encode())
host['repl_decoded'] = host['repl']
host['repl'] = host['repl'].encode()
host['mime_types'] = frozenset(host.get('excluded_routes', ()))
host['mime_types'] = frozenset(host.get('mime_types', ()))
host['excluded_routes'].sort(key=len, reverse=True)
return config
@ -65,6 +65,7 @@ async def handler(request):
print('Not configured to replace for MIME type', upstream_resp.content_type)
return await proxy_passthrough(upstream_resp, resp)
print('replacing', repr(hconfig['pattern_decoded']), 'with', repr(hconfig['repl_decoded']))
return await proxy_replace(hconfig, upstream_resp, resp)
async def proxy_replace(hconfig, upstream_resp, resp):