Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #11394
Closed
Open
Issue created Jan 25, 2022 by Administrator@rootContributor

[REQ][typescript] Expose Agent option in RequestContext interface

Created by: davidgamero

Is your feature request related to a problem? Please describe.

When implementing SSL Auth, passing certificates requires access to the agent option on the fetch(url: RequestInfo, init?: RequestInit): Promise<Response>; call in order to pass ca and cert params. The RequestContext interface bridges the SecurityAuthentication implementation to the fetch call, and therefore is the optimal choice for passing an optional agent: http.Agent | https.Agent.

Describe the solution you'd like

The addition of an agent: http.Agent | https.Agent | undefined instance variable on the RequestContext class as well as the following methods:

setAgent(agent: http.Agent | https.Agent)
getAgent() : http.Agent | https.Agent | undefined

Then, the isomorphic fetch implementation would call getAgent() to pass the value into the agent option on the fetch call in isomorphic-fetch.ts

Describe alternatives you've considered

Another viable option is the allow direct access to the fetch options in the RequestContext, which was the approach in the previous iteration of the typescript generator. This would prevent future one-off additions for other options, but would significantly increase the scope of the PR, and may be unnecessary given the major auth options are already exposed excluding the agent.

This could introduce undesired behavior in which the same option could be potentially passed twice in one call (once in RequestContext instance var and once via fetch options override)

Additional context

This would expand the typescript generator's auth compatibility :)

Assignee
Assign to
Time tracking