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
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
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)