pipeline siivous ja testikattavuuden nosto (#9)
Co-authored-by: moilanik <niko.moilanen@tietoevry.com> Reviewed-on: #9
This commit is contained in:
@@ -46,7 +46,7 @@ class H(http.server.BaseHTTPRequestHandler):
|
||||
def _log_request(self, method):
|
||||
path = self.path
|
||||
content_len = int(self.headers.get('Content-Length', 0))
|
||||
body = self.rfile.read(content_len).decode() if content_len else ''
|
||||
body = self.rfile.read(content_len).decode(errors='replace') if content_len else ''
|
||||
line = f'{method} {path}\n{body}\n'
|
||||
with open(REQ_FILE, 'a') as f:
|
||||
f.write(line)
|
||||
@@ -67,6 +67,14 @@ class H(http.server.BaseHTTPRequestHandler):
|
||||
self.end_headers()
|
||||
self.wfile.write(body.encode())
|
||||
|
||||
def do_PATCH(self):
|
||||
self._log_request('PATCH')
|
||||
code, body = self._get_response()
|
||||
self.send_response(code)
|
||||
self.send_header('Content-Type', 'application/json')
|
||||
self.end_headers()
|
||||
self.wfile.write(body.encode())
|
||||
|
||||
def log_message(self, format, *args):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user