Closed byaka closed 9 years ago
class myRequestHandler(SimpleJSONRPCRequestHandler): rpc_paths=('/adWolf-accApi') def do_OPTIONS(self): self.send_response(200) self.end_headers() def do_GET(self): self.send_response(200) self.end_headers() def do_POST(self): SimpleJSONRPCRequestHandler.do_POST(self) def end_headers(self): self.send_header('Access-Control-Allow-Headers', 'Origin, Authorization, X-Requested-With, Content-Type, Accept') self.send_header('Access-Control-Allow-Origin', '*') self.send_header('Access-Control-Max-Age', '0') self.send_header('Access-Control-Allow-Methods', 'GET, PUT, POST, DELETE, OPTIONS') SimpleJSONRPCRequestHandler.end_headers(self)
how to do this right?
That works fine, and the do_POST() isn't necessary.
do_POST()
If you don't want to send those headers while handling a POST request, just test the self.command field in the end_header method.
self.command
end_header
Ok, Thank u
how to do this right?