Skip to content
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] [Typescript] Response headers are not available. #12855

Open
6 tasks
acabarbaye opened this issue Jul 13, 2022 · 7 comments
Open
6 tasks

[BUG] [Typescript] Response headers are not available. #12855

acabarbaye opened this issue Jul 13, 2022 · 7 comments

Comments

@acabarbaye
Copy link
Contributor

acabarbaye commented Jul 13, 2022

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

I want to access the response headers for an E-tag. In the openAPI yaml file, the headers are defined for the response but it doesn't generate anything to access them

      responses:
        '200':
          description: Resource returned OK.
          headers:
            Cache-Control:
              $ref: '#/components/headers/CacheControlHeader'
            ETag:
              $ref: '#/components/headers/ETagHeader'
            Version:
              $ref: '#/components/headers/VersionHeader'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/....'

the header is defined as follows:

    ETagHeader:
      description: 'Caching: An opaque string which identifies a specific version of the returned resource.'
      schema:
        type: string

The problem with the headers in the response not being accessible (especially E-tag) seems to be faced by other typescript-xxx client generators #6527

@davidediak
Copy link
Contributor

any news on this? I'd also want to retrieve the ETag header

@excavador
Copy link

Any updates?

@Robbilie
Copy link
Contributor

@excavador Check this out, it's already available:

#16260

@purrden
Copy link

purrden commented Nov 23, 2023

Hi @Robbilie, can you please advise if I need to provide any specific settings via config to the generator to get methods with WithHttpInfo suffix?

@Robbilie
Copy link
Contributor

They should be included by default since the new methods are used by the old ones. I'm still using my own branch for generating the client and haven't tried with the main branch

@excavador
Copy link

@Robbilie Shell we close this issue as resolved?

@Robbilie
Copy link
Contributor

I think my PR solved this, even though t doesn't necessarily enforce the types that are defined in the openapi spec it at least grants access to them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants