Skip to content

Commit

Permalink
Fix: Error data was JSON encoded twice
Browse files Browse the repository at this point in the history
The result sent was always a string containing encoded JSON.

Solution: Use the argument `text` instead of `data` to pass the data as a UTF-8 string.
  • Loading branch information
hoh committed Apr 9, 2024
1 parent 4989892 commit 2f5aa79
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/aleph/vm/orchestrator/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ async def update_allocations(request: web.Request):
data = await request.json()
allocation = Allocation.parse_obj(data)
except ValidationError as error:
return web.json_response(data=error.json(), status=web.HTTPBadRequest.status_code)
return web.json_response(text=error.json(), status=web.HTTPBadRequest.status_code)

pubsub: PubSub = request.app["pubsub"]
pool: VmPool = request.app["vm_pool"]
Expand Down

0 comments on commit 2f5aa79

Please sign in to comment.