Skip to content

Commit

Permalink
Merge pull request #1096 from xcube-dev/forman-x-fix_viewer_state_err…
Browse files Browse the repository at this point in the history
…or_code

HTTP status 504 -> 501
  • Loading branch information
forman authored Dec 17, 2024
2 parents ba484bf + 0fba496 commit aa4f430
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/webapi/viewer/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class ViewerStateRoutesNoConfigTest(RoutesTestCase):

def test_get(self):
response = self.fetch("/viewer/state")
self.assertEqual(504, response.status)
self.assertEqual(501, response.status)
self.assertEqual("Persistence not supported", response.reason)

def test_put(self):
response = self.fetch("/viewer/state", method="PUT", body={"state": 123})
self.assertEqual(504, response.status)
self.assertEqual(501, response.status)
self.assertEqual("Persistence not supported", response.reason)


Expand Down
6 changes: 4 additions & 2 deletions xcube/webapi/viewer/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ class ViewerStateHandler(ApiHandler[ViewerContext]):
)
def get(self):
if self.ctx.persistence is None:
self.response.set_status(504, "Persistence not supported")
# 501: Not Implemented
self.response.set_status(501, "Persistence not supported")
return
key = self.request.get_query_arg("key", type=str, default="")
if key:
Expand All @@ -144,7 +145,8 @@ def get(self):
)
def put(self):
if self.ctx.persistence is None:
self.response.set_status(504, "Persistence not supported")
# 501: Not Implemented
self.response.set_status(501, "Persistence not supported")
return
state = self.request.body
key = self.new_key()
Expand Down

0 comments on commit aa4f430

Please sign in to comment.