We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am unable to access response headers that share the same name.
7.7.0
Irrelevant as the issue lies in the python client itself.
I was able to work around this by overriding the templates locally and adding the following 2 lines.
diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index c7d4a6d700f..dc9c9057cf9 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -335,6 +335,7 @@ class ApiClient: status_code = response_data.status, data = return_data, headers = response_data.getheaders(), + full_headers = tuple(response_data.getheaders().items()), raw_data = response_data.data ) diff --git a/modules/openapi-generator/src/main/resources/python/api_response.mustache b/modules/openapi-generator/src/main/resources/python/api_response.mustache index 9bc7c11f6b9..136a745cb69 100644 --- a/modules/openapi-generator/src/main/resources/python/api_response.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_response.mustache @@ -13,6 +13,7 @@ class ApiResponse(BaseModel, Generic[T]): status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + full_headers: tuple[tuple[str, str], ...] = Field(None, description="Full HTTP headers") data: T = Field(description="Deserialized data given the data type") raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
The text was updated successfully, but these errors were encountered:
@tom300z what about running tuple(api_response.headers.items()) using the existing headers field? would that meet your requirement?
tuple(api_response.headers.items())
headers
Sorry, something went wrong.
Yes, that should work too
No branches or pull requests
Bug Report Checklist
Description
I am unable to access response headers that share the same name.
openapi-generator version
7.7.0
OpenAPI declaration file content or url
Irrelevant as the issue lies in the python client itself.
Steps to reproduce
Suggest a fix
I was able to work around this by overriding the templates locally and adding the following 2 lines.
The text was updated successfully, but these errors were encountered: