-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[BUG] Headers not copied into Raw response headers array. #6527
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
Any progress on this or a timeline on when it might be added? |
I run into the same issue that a custom response header was not inside the header array. Investigating the server response with browser developer tools showed that the header exists. After some research i think it is not a bug of the typescript-fetch generator. It is more likely that custom response headers are not accessible due to the cors nature of the request https://developers.google.com/web/updates/2015/03/introduction-to-fetch#response_types The relevant part:
If you don't provide a fetchApi per configuration the browser fetchApi implementation is used and this one takes care of copying headers to the array of the response object (and only the ones you are allowed to view): Solution (worked for me): The server must provide the "Access-Control-Expose-Headers" Header field. As value define all the custom header names that are not part of the default cors header list: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers |
Bug Report Checklist
Description
When calling this method I know from the documents that the response provides details of a document created in the header.location but I can't examine this with the typescript-fetch API? The following snippet from a React test app is where I see the response headers are empty. If I use the standard dap
openapi-generator version
4.3.1
OpenAPI declaration file content or url
https://raw.githubusercontent.com/legalesign/Legalesign-V1-OpenAPI3/master/legalesign-api-v1.yaml
Command line used for generation
openapi-generator generate -i https://raw.githubusercontent.com/legalesign/Legalesign-V1-OpenAPI3/master/legalesign-api-v1.yaml -g typescript-fetch --additional-properties supportsES6=true
Steps to reproduce
Execute generation, make any Raw Api call - check response.headers.
Related issues/PRs
swagger-api/swagger-codegen#7828
Suggest a fix
Should the baseApi.fetchApi.response be mapping onto this?
The text was updated successfully, but these errors were encountered: