Skip to content

Commit

Permalink
accept OPTIONS on trackhub URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
hpratt committed Dec 10, 2021
1 parent c92e605 commit b8edf23
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions api/main_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -82,19 +85,28 @@ 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()))

@cherrypy.expose
@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()))

Expand Down

0 comments on commit b8edf23

Please sign in to comment.