Skip to content

Formatting response bodies #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions arangoasync/aql.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ async def explain(
def response_handler(resp: Response) -> Json:
if not resp.is_success:
raise AQLQueryExplainError(resp, request)
return self.deserializer.loads(resp.raw_body)
return Response.format_body(self.deserializer.loads(resp.raw_body))

return await self._executor.execute(request, response_handler)

Expand Down Expand Up @@ -625,7 +625,7 @@ async def validate(self, query: str) -> Result[Json]:
def response_handler(resp: Response) -> Json:
if not resp.is_success:
raise AQLQueryValidateError(resp, request)
return self.deserializer.loads(resp.raw_body)
return Response.format_body(self.deserializer.loads(resp.raw_body))

return await self._executor.execute(request, response_handler)

Expand Down Expand Up @@ -719,7 +719,7 @@ async def create_function(
def response_handler(resp: Response) -> Json:
if not resp.is_success:
raise AQLFunctionCreateError(resp, request)
return self.deserializer.loads(resp.raw_body)
return Response.format_body(self.deserializer.loads(resp.raw_body))

return await self._executor.execute(request, response_handler)

Expand Down Expand Up @@ -760,6 +760,6 @@ def response_handler(resp: Response) -> Json:
if not resp.is_success:
if not (resp.status_code == HTTP_NOT_FOUND and ignore_missing):
raise AQLFunctionDeleteError(resp, request)
return self.deserializer.loads(resp.raw_body)
return Response.format_body(self.deserializer.loads(resp.raw_body))

return await self._executor.execute(request, response_handler)
5 changes: 1 addition & 4 deletions arangoasync/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2592,10 +2592,7 @@ async def edges(
def response_handler(resp: Response) -> Json:
if not resp.is_success:
raise EdgeListError(resp, request)
body = self.deserializer.loads(resp.raw_body)
for key in ("error", "code"):
body.pop(key)
return body
return Response.format_body(self.deserializer.loads(resp.raw_body))

return await self._executor.execute(request, response_handler)

Expand Down
8 changes: 4 additions & 4 deletions arangoasync/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ async def view(self, name: str) -> Result[Json]:
def response_handler(resp: Response) -> Json:
if not resp.is_success:
raise ViewGetError(resp, request)
return self.deserializer.loads(resp.raw_body)
return Response.format_body(self.deserializer.loads(resp.raw_body))

return await self._executor.execute(request, response_handler)

Expand All @@ -1280,7 +1280,7 @@ async def view_info(self, name: str) -> Result[Json]:
def response_handler(resp: Response) -> Json:
if not resp.is_success:
raise ViewGetError(resp, request)
return self.deserializer.loads(resp.raw_body)
return Response.format_body(self.deserializer.loads(resp.raw_body))

return await self._executor.execute(request, response_handler)

Expand Down Expand Up @@ -2006,7 +2006,7 @@ def response_handler(resp: Response) -> Json:
if not resp.is_success:
raise JWTSecretListError(resp, request)
result: Json = self.deserializer.loads(resp.raw_body)
return result
return Response.format_body(result)

return await self._executor.execute(request, response_handler)

Expand All @@ -2028,7 +2028,7 @@ def response_handler(resp: Response) -> Json:
if not resp.is_success:
raise JWTSecretReloadError(resp, request)
result: Json = self.deserializer.loads(resp.raw_body)
return result
return Response.format_body(result)

return await self._executor.execute(request, response_handler)

Expand Down
Loading