Skip to content

Commit 87e9f6f

Browse files
committed
Enhance NDJSON response handling in _parse_response function
This commit updates the `_parse_response` function in `execute_cypher_query.py` to return `None` for NDJSON responses, improving the robustness of response parsing. This change ensures that the function correctly identifies NDJSON content types and avoids unnecessary parsing attempts. Testing Notes: - Verify that NDJSON responses are handled correctly without errors. - Ensure that other response types continue to be processed as expected.
1 parent e650c4c commit 87e9f6f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎robosystems_client/api/query/execute_cypher_query.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ def _parse_response(
6161
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
6262
) -> Optional[Union[Any, HTTPValidationError]]:
6363
if response.status_code == 200:
64+
content_type = response.headers.get("content-type", "")
65+
if (
66+
"application/x-ndjson" in content_type
67+
or response.headers.get("x-stream-format") == "ndjson"
68+
):
69+
return None
6470
response_200 = response.json()
6571
return response_200
6672

0 commit comments

Comments
 (0)