This is not a problem with Godot, but the way you're using Python's SimpleHTTPServer module.
The example code in the documentation does not support POST requests, but if you extend it with a custom handler class, you can get something that works for debugging purposes:
import SimpleHTTPServer
import SocketServer
import json
PORT = 8000
class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_POST(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(json.dumps({"success": True}))
content_length = int(self.headers['Content-Length'])
json_string = self.rfile.read(content_length)
data = json.loads(json_string)
print data
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()
Note that the key here is to provide a handler which implements the do_POST()
method.
You can test this back-end with a simple curl request:
curl -d '{"foo":"bar","baz":true}' http://localhost:8000
This is fine for the purpose of debugging, but if you plan on implementing a real back-end in Python, I would suggest using Flask instead, which comes with lots of nice features out of the box.