diff options
Diffstat (limited to 'test/server.py')
-rwxr-xr-x | test/server.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/server.py b/test/server.py index 9cab5cc..0963b5b 100755 --- a/test/server.py +++ b/test/server.py @@ -31,6 +31,7 @@ wrapping the classes in proxy_core.py from pathlib import Path from urllib.parse import parse_qs from threading import Thread +import traceback from .proxy_core import ProxyRequestHandler, ThreadingHTTPServer from .misc_constants import * @@ -84,8 +85,10 @@ class RequestHijacker(ProxyRequestHandler): status_code, headers = 404, {'Content-Type': 'text/plain'} resp_body = b'Handler for this URL not found.' - except Exception as e: - status_code, headers, resp_body = 500, {'Content-Type': 'text/plain'}, b'Internal Error:\n' + repr(e).encode() + except Exception: + status_code = 500 + headers = {'Content-Type': 'text/plain'} + resp_body = b'Internal Error:\n' + traceback.format_exc().encode() headers['Content-Length'] = str(len(resp_body)) self.send_response(status_code) |