Respond to OPTIONS in rpc
This commit is contained in:
parent
474ef21163
commit
7895442b51
@ -60,6 +60,12 @@ class OnionrRPC(object):
|
|||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def rpc(self):
|
def rpc(self):
|
||||||
# Dispatcher is dictionary {<method_name>: callable}
|
# Dispatcher is dictionary {<method_name>: callable}
|
||||||
|
|
||||||
|
if cherrypy.request.method == 'OPTIONS':
|
||||||
|
cherrypy.response.headers['Access-Control-Allow-Origin'] = '*'
|
||||||
|
cherrypy.response.headers['Access-Control-Allow-Methods'] = 'POST'
|
||||||
|
return ''
|
||||||
|
|
||||||
data = cherrypy.request.body.read().decode('utf-8')
|
data = cherrypy.request.body.read().decode('utf-8')
|
||||||
|
|
||||||
response = JSONRPCResponseManager.handle(data, dispatcher)
|
response = JSONRPCResponseManager.handle(data, dispatcher)
|
||||||
|
Loading…
Reference in New Issue
Block a user