Skip to content
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
17 changes: 9 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ sgqlc-codegen = 'sgqlc.codegen:main'
websocket = ['websocket-client']
requests = ['requests']
httpx = ['httpx']
pytest = ['pytest']

[tool.poetry.group.dev.dependencies]
pytest = '*'
Expand Down
2 changes: 1 addition & 1 deletion sgqlc/endpoint/httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ async def runner():
try:
response = self.client.send(req)
return self._parse_httpx_response(query, response)
except httpx.HTTPError as exc:
except httpx.HTTPStatusError as exc:
Comment thread
barbieri marked this conversation as resolved.
return self._log_httpx_error(query, req, exc)

def _parse_httpx_response(self, query, response):
Expand Down
16 changes: 16 additions & 0 deletions tests/test-endpoint-httpx.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json

import httpx
import pytest

from sgqlc.endpoint.httpx import HTTPXEndpoint
from sgqlc.types import Schema, Type
Expand Down Expand Up @@ -551,6 +552,21 @@ def test_server_http_non_conforming_json(respx_mock):
check_respx_route(route)


def test_server_http_transport_error(respx_mock):
'Test if a transport error will get passed back to the caller'

Copilot AI Oct 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Function docstring should use triple quotes for multi-line format consistency with other test functions.

Suggested change
'Test if a transport error will get passed back to the caller'
"""Test if a transport error will get passed back to the caller"""

Copilot uses AI. Check for mistakes.

route = respx_mock.route(name='graphql', method='POST', url=test_url).mock(
side_effect=httpx.RemoteProtocolError
)

endpoint = HTTPXEndpoint(test_url)

with pytest.raises(httpx.RemoteProtocolError):
endpoint(graphql_query)

check_respx_route(route)


def test_server_error_broken_json(respx_mock):
'Test if HTTP error with broken JSON payload is handled'

Expand Down