extensions/openai: include content-length for json replies (#3416)

This commit is contained in:
matatonic 2023-08-03 15:10:49 -04:00 committed by GitHub
parent 32e7cbb635
commit 8f98268252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,10 +67,13 @@ class Handler(BaseHTTPRequestHandler):
self.send_response(code)
self.send_access_control_headers()
self.send_header('Content-Type', 'application/json')
self.end_headers()
response = json.dumps(ret)
r_utf8 = response.encode('utf-8')
self.send_header('Content-Length', str(len(r_utf8)))
self.end_headers()
self.wfile.write(r_utf8)
if not no_debug:
debug_msg(r_utf8)