我尝试使用 send_header('Content-Type', 'text/html')。但是,这不起作用。
请您参考如下方法:
以下在派生自 http.server.BaseHTTPRequestHandler 的类中对我有用:
self.send_response(200)
self.send_header("Content-type", "text/plain")
self.end_headers()
# Your response body follows with self.wfile.write()
