@@ -11,12 +11,11 @@ from ... import errors
1111{{ relative }}
1212{% endfor %}
1313
14- {% set all_standard_response_codes = endpoint .responses |map (attribute ="status_code" )|map (attribute ="is_official" )|all %}
15- {% if config .allow_int_response_codes and not all_standard_response_codes %}
16- HTTPStatus = int
14+ {% if config .allow_int_response_codes and not endpoint .responses |map (attribute ="status_code" )|map (attribute ="is_official" )|all %}
15+ {% set http_status_type = "int" %}
1716{% else %}
1817import http
19- HTTPStatus = http.HTTPStatus
18+ {% set http_status_type = " http.HTTPStatus" %}
2019{% endif %}
2120
2221{% from "endpoint_macros.py.jinja" import header_params , cookie_params , query_params ,
@@ -99,9 +98,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res
9998 {% endif %}
10099
101100
102- def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[{{ return_string }}, HTTPStatus ]:
101+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[{{ return_string }}, {{ http_status_type }} ]:
103102 return Response(
104- status_code=HTTPStatus (response.status_code),
103+ status_code={{ http_status_type }} (response.status_code),
105104 content=response.content,
106105 headers=response.headers,
107106 parsed=_parse_response(client=client, response=response),
@@ -110,7 +109,7 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res
110109
111110def sync_detailed(
112111 {{ arguments(endpoint) | indent(4) }}
113- ) -> Response[{{ return_string }}, HTTPStatus ]:
112+ ) -> Response[{{ return_string }}, {{ http_status_type }} ]:
114113 {{ docstring(endpoint, return_string, is_detailed=true) | indent(4) }}
115114
116115 kwargs = _get_kwargs(
@@ -136,7 +135,7 @@ def sync(
136135
137136async def asyncio_detailed(
138137 {{ arguments(endpoint) | indent(4) }}
139- ) -> Response[{{ return_string }}, HTTPStatus ]:
138+ ) -> Response[{{ return_string }}, {{ http_status_type }} ]:
140139 {{ docstring(endpoint, return_string, is_detailed=true) | indent(4) }}
141140
142141 kwargs = _get_kwargs(
0 commit comments