Skip to content

Commit

Permalink
fix: add OPTIONS /submit-job endpoint for CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
glevco committed Dec 20, 2024
1 parent d9bc9e4 commit 2ffcb5b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions txstratum/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def __init__(
self.app.router.add_get("/health", self.health)
self.app.router.add_get("/mining-status", self.mining_status)
self.app.router.add_get("/job-status", self.job_status)
self.app.router.add_options("/submit-job", self.submit_job_options)
self.app.router.add_post("/submit-job", self.submit_job)
self.app.router.add_post("/cancel-job", self.cancel_job)

Expand Down Expand Up @@ -120,6 +121,10 @@ async def mining_status(self, request: web.Request) -> web.Response:
"""Return status of miners."""
return web.json_response(self.manager.status())

async def submit_job_options(self, request: web.Request) -> web.Response:
"""This endpoint is required to make CORS work when using the desktop wallet with a local tx-mining-service."""
return web.json_response("{}", status=200)

async def submit_job(self, request: web.Request) -> web.Response:
"""Submit a new tx job to the manager.
Expand Down

0 comments on commit 2ffcb5b

Please sign in to comment.