diff --git a/api/main_apis.py b/api/main_apis.py index d540a91d9..2a8f4376a 100644 --- a/api/main_apis.py +++ b/api/main_apis.py @@ -70,6 +70,9 @@ def factorbook_downloads(self, *args, **kwargs): @cherrypy.expose def hubs(self, *args, **kwargs): + if cherrypy.request.method == 'OPTIONS': + cherrypy_cors.preflight(allowed_methods = [ 'POST' ]) + return return requests.get("http://gcp.wenglab.org/hubs/" + '/'.join(args)).text @cherrypy.expose @@ -82,12 +85,18 @@ def ctlist(self, *args, **kwargs): @cherrypy.expose def ucsc_trackhub(self, *args, **kwargs): + if cherrypy.request.method == 'OPTIONS': + cherrypy_cors.preflight(allowed_methods = [ 'POST' ]) + return return self.trackhub.ucsc_trackhub(*args, **kwargs) @cherrypy.expose @cherrypy.tools.json_in() @cherrypy.tools.json_out() def ucsc_trackhub_url(self, *args, **kwargs): + if cherrypy.request.method == 'OPTIONS': + cherrypy_cors.preflight(allowed_methods = [ 'POST' ]) + return j = cherrypy.request.json return self.trackhub.ucsc_trackhub_url(j, j["uuid"] if "uuid" in j else str(uuid.uuid4())) @@ -95,6 +104,9 @@ def ucsc_trackhub_url(self, *args, **kwargs): @cherrypy.tools.json_in() @cherrypy.tools.json_out() def ucsc_trackhub_url_snp(self, *args, **kwargs): + if cherrypy.request.method == 'OPTIONS': + cherrypy_cors.preflight(allowed_methods = [ 'POST' ]) + return j = cherrypy.request.json return self.trackhub.ucsc_trackhub_url_snp(j, j["uuid"] if "uuid" in j else str(uuid.uuid4()))