mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Add http.error_handler().
This commit is contained in:
parent
a2f8e4bcba
commit
a74925e313
1 changed files with 13 additions and 0 deletions
|
|
@ -59,3 +59,16 @@ def json_file_handler(data):
|
|||
pass
|
||||
|
||||
return HTTPHandler
|
||||
|
||||
|
||||
def error_handler(code, msg):
|
||||
"""Return an HTTP handler that always returns the given error code."""
|
||||
|
||||
class HTTPHandler(http.server.BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
self.send_error(code, msg)
|
||||
|
||||
def log_message(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
return HTTPHandler
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue